WSMethodInvocationInvoke and Microsoft TerraServer?
WSMethodInvocationInvoke and Microsoft TerraServer?
- Subject: WSMethodInvocationInvoke and Microsoft TerraServer?
- From: Steve Mykytyn <email@hidden>
- Date: Thu, 15 May 2003 19:38:07 -0700
Microsoft provides SOAP access to its TerraServer (see
http://terraserver.microsoft.com/TerraService.asmx), and I can *almost*
talk to it using Web Services.
After quite a bit of fiddling, WSMethodResultIsFault says the returned
result is OK,
if I turn on the debugging properties the outgoing header and body look
OK, as do the incoming.
But Microsoft doesn't seem to read the input parameters correctly on
its end,
and worse I can't pull any results out of the returned dictionary
Suggestions from the experienced? (source and the XML incoming and
outgoing follow)
Source
WSMethodInvocationRef soapCall;
NSURL *soapURL;
NSString *methodName;
NSMutableDictionary *parameters;
NSMutableDictionary *lonlat;
NSDictionary *result;
soapURL = [NSURL URLWithString:
@"
http://terraserver.microsoft.com/TerraService.asmx"];
methodName = @"ConvertLonLatPtToUtmPt";
soapCall =
WSMethodInvocationCreate((CFURLRef)soapURL,(CFStringRef)methodName,
kWSSOAP2001Protocol);
WSMethodInvocationSetProperty
(soapCall,kWSDebugOutgoingHeaders,kCFBooleanTrue);
WSMethodInvocationSetProperty(soapCall
,kWSDebugOutgoingBody,kCFBooleanTrue);
WSMethodInvocationSetProperty
(soapCall,kWSDebugIncomingHeaders,kCFBooleanTrue);
WSMethodInvocationSetProperty(soapCall
,kWSDebugIncomingBody,kCFBooleanTrue);
WSMethodInvocationSetProperty(soapCall, kWSSOAPBodyEncodingStyle,
(NSString*) kWSSOAPStyleDoc);
NSString* soapAction = @"SOAPAction";
NSString* soapActionValue =
@"
http://terraservice.net/terraserver/ConvertLonLatPtToUtmPt";
NSDictionary* headers = [[NSDictionary
dictionaryWithObjects:&soapActionValue forKeys: &soapAction count: 1]
retain];
WSMethodInvocationSetProperty(soapCall, kWSHTTPExtraHeaders, headers);
[headers release];
WSMethodInvocationSetProperty(soapCall, kWSSOAPMethodNamespaceURI,
@"
http://terraservice.net/terraserver");
parameters = [NSMutableDictionary dictionaryWithCapacity:1];
lonlat = [NSMutableDictionary dictionaryWithCapacity:2];
[lonlat setObject:[NSNumber numberWithDouble:-122.4276]
forKey:@"Lon"];
[lonlat setObject:[NSNumber numberWithDouble:37.7875671]
forKey:@"Lat"];
[parameters setObject:lonlat forKey:@"point"];
WSMethodInvocationSetParameters(soapCall, (CFDictionaryRef)parameters,
(CFArrayRef)nil);
result = (NSDictionary *)WSMethodInvocationInvoke(soapCall);
if (WSMethodResultIsFault((CFDictionaryRef) result)) {
NSRunAlertPanel([NSString stringWithFormat:@"Error %@",
[result objectForKey:(NSString *)kWSFaultCode]],
[result objectForKey:(NSString *)kWSFaultString],
@"OK",@"",@"");
}
else {
NSLog([[result objectForKey:(NSString *)kWSDebugOutgoingHeaders]
description]);
NSLog([[result objectForKey:(NSString *)kWSDebugOutgoingBody]
description]);
NSLog([[result objectForKey:(NSString *)kWSDebugIncomingHeaders]
description]);
NSLog([[result objectForKey:(NSString *)kWSDebugIncomingBody]
description]);
NSLog(@"The results dictionary contains %d keys",[result count]);
NSDictionary *values = [result objectForKey:(NSString
*)kWSMethodInvocationResult ];
if (values) NSLog(@"There is a result dictionary");
else NSLog(@"There is NOT a result dictionary");
NSLog(@"The response is %@",[result objectForKey:(NSString
*)kWSHTTPResponseMessage ]);
XML OUTGOING HEADER
2003-05-15 19:16:46.325 exoMap[12521] {
"Content-Type" = "text/xml";
Host = "terraserver.microsoft.com";
Soapaction =
"
http://terraservice.net/terraserver/ConvertLonLatPtToUtmPt";
"User-Agent" = "Mac OS X; WebServicesCore.framework (1.0.1)";
}
XML OUTGOING BODY
2003-05-15 19:16:46.325 exoMap[12521] <?xml version="1.0"
encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="
http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ConvertLonLatPtToUtmPt
xmlns="
http://terraservice.net/terraserver">
<point xsi:type="SOAP-ENC:Dictionary">
<Lon xsi:type="xsd:double">-122.42755</Lon>
<Lat xsi:type="xsd:double">37.787537</Lat>
</point>
</ConvertLonLatPtToUtmPt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML INCOMING HEADER
2003-05-15 19:16:46.325 exoMap[12521] {
"Cache-Control" = "private, max-age=0";
"Content-Length" = 465;
"Content-Type" = "text/xml; charset=utf-8";
Date = "Fri, 16 May 2003 02:15:51 GMT";
P3p = "CP=\\\\"BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo\\\\"";
Server = "Microsoft-IIS/5.0";
}
XML INCOMING BODY
2003-05-15 19:16:46.326 exoMap[12521] <?xml version="1.0"
encoding="utf-8"?><soap:Envelope
xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="
http://www.w3.org/2001/
XMLSchema"><soap:Body><ConvertLonLatPtToUtmPtResponse
xmlns="
http://terraservice.net/terraserver/
"><ConvertLonLatPtToUtmPtResult><Zone>31</Zone><X>166021.44317933213</
X><Y>0</Y></ConvertLonLatPtToUtmPtResult></
ConvertLonLatPtToUtmPtResponse></soap:Body></soap:Envelope>
2003-05-15 19:16:46.326 exoMap[12521] The results dictionary contains 5
keys
2003-05-15 19:16:46.326 exoMap[12521] There is NOT a result dictionary
2003-05-15 19:16:46.326 exoMap[12521] The response is <CFHTTPMessage
0x1cc8ff0>{url =
http://terraserver.microsoft.com/TerraService.asmx;
status = HTTP/1.1 200 OK}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.