Web Services, SOAP, and namespaces?
Web Services, SOAP, and namespaces?
- Subject: Web Services, SOAP, and namespaces?
- From: Steve Mykytyn <email@hidden>
- Date: Wed, 21 May 2003 16:52:16 -0700
suggestions, please?
after suffering with Web Services for a couple days, it almost works
talking to a Microsoft SOAP server: i get an NSDictionary back with the
results, but it's clear that the parameters are not getting through
correctly as the values returned are garbage. i would like to insert
the line
xmlns:ts="
http://terraservice.net/terraserver/"
into a SOAP envelope that looks like:
<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>
<m:ConvertLonLatPtToUtmPt
xmlns:m="
http://terraservice.net/terraserver/">
<point xsi:type="ts:LonLatPt">
<Lon xsi:type="xsd:double">-122.42755</Lon>
<Lat xsi:type="xsd:double">37.787537</Lat>
</point>
</m:ConvertLonLatPtToUtmPt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The code that generates this XML looks like:
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*) kWSSOAPStyleRPC);
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:3];
[lonlat setObject:@"ts:LonLatPt" forKey:kWSRecordType];
[lonlat setObject:[NSNumber numberWithDouble:-122.43e0]
forKey:@"Lon"];
[lonlat setObject:[NSNumber numberWithDouble:37.78e0] forKey:@"Lat"];
[parameters setObject:lonlat forKey:@"point"];
WSMethodInvocationSetParameters(soapCall, (CFDictionaryRef)parameters,
(CFArrayRef)nil);
result = (NSDictionary *)WSMethodInvocationInvoke(soapCall);
_______________________________________________
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.