I am using the WSMethodInvocationCreate() method and WSMethodInvocation… methods and that worked great until 10.7.
I now want to compile my application under 10.8 and I get the warnings that these methods are deprecated under 10.8.
I cannot find some useful information about the way to do it under 10.8.
Does anybody know how to do this or where to find the information about it?
Thanks,
Here is the code involved :
#import "SoapCallClass.h"
@implementation SoapCallClass
// Setters
-(void) setEindpointpath: (NSString *) thepath{
eindpointpath = thepath;
}
-(void) setMethodName: (NSString *) methodName {
mymethodName = methodName ;
}
-(void) setNameSpace: (NSString *) nameSpace {
mynameSpace = nameSpace;
}
-(void) setParams: (NSString *) params {
myparams = params;
}
-(void) setParamsOrder: (NSArray *) paramsOrder {
myparamsOrder = paramsOrder;
}
-(void) setReqHeaders: (NSDictionary *) reqHeaders {
myreqHeaders = reqHeaders ;
}
// Getters
-(NSString *) eindpointpath {
return eindpointpath;
}
-(NSString *) methodName {
return mymethodName;
}
-(NSString *) nameSpace {
return mynameSpace;
}
-(NSString *) params {
return myparams;
}
-(NSArray *) paramsOrder {
return myparamsOrder;
}
-(NSDictionary *) reqHeaders {
return myreqHeaders;
}
// Soap call method
-(NSString *) getSoapXML {
NSDate *startTime = [NSDate date];
NSURL *storeURL = [NSURL URLWithString:eindpointpath];
WSMethodInvocationRef rpcCall;
rpcCall = WSMethodInvocationCreate((CFURLRef) storeURL, (CFStringRef) mymethodName, kWSSOAP2001Protocol);
WSMethodInvocationSetParameters (rpcCall, (CFDictionaryRef) myparams, (CFArrayRef)myparamsOrder);
WSMethodInvocationSetProperty(rpcCall, (CFStringRef) kWSHTTPExtraHeaders, (CFTypeRef) myreqHeaders);
// for good measure, make the call follow redirects.
WSMethodInvocationSetProperty(rpcCall, kWSHTTPFollowsRedirects, kCFBooleanTrue);
WSMethodInvocationSetProperty(rpcCall, kWSSOAPMethodNamespaceURI, (CFStringRef) mynameSpace);
// set debug props
WSMethodInvocationSetProperty(rpcCall, kWSDebugIncomingBody, kCFBooleanTrue);
// WSMethodInvocationSetProperty(rpcCall, kWSDebugIncomingHeaders, kCFBooleanTrue);
// WSMethodInvocationSetProperty(rpcCall, kWSDebugOutgoingBody, kCFBooleanTrue);
// WSMethodInvocationSetProperty(rpcCall, kWSDebugOutgoingHeaders, kCFBooleanTrue);
NSDictionary *result;
result = (NSDictionary *) (WSMethodInvocationInvoke(rpcCall));
// get HTTP response from SOAP request so we can see the status code
CFHTTPMessageRef res = (CFHTTPMessageRef) [result objectForKey:(id)kWSHTTPResponseMessage];
long resStatusCode = CFHTTPMessageGetResponseStatusCode(res);
NSLog(@"Status Code %ld\n", resStatusCode);
//CFHTTPMessageRef headers = (CFHTTPMessageRef)CFDictionaryGetValue (result,kWSHTTPResponseMessage);
// NSLog(@"%@\n", res);
// CFDictionaryRef headerDict = CFHTTPMessageCopyAllHeaderFields(res);
// NSLog(@"%@\n", headerDict);
// NSLog(@"%@\n", [result objectForKey:@"/WSDebugInBody"]);
if (WSMethodResultIsFault ((CFDictionaryRef) result)) {
// NSLog(@"result = %@", [result objectForKey: (NSString *) kWSFaultString]);
NSLog(@"\nERROR = %@\n\n", [result objectForKey:@"/FaultString"]);
// [result setStringValue: @"Error"];
return [result objectForKey:@"/FaultString"];
} else {
//NSLog(@"result = %@\n", [result objectForKey:@"GetOrderInfoboxResult"]);
}
NSTimeInterval elapsedTime = -[startTime timeIntervalSinceNow];
NSLog(@"Soap call took %f seconds", elapsedTime);
return [result objectForKey:@"/WSDebugInBody"];
}
@end