Soap calls, WSMethodInvocationCreate

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


My guess is that you have to do it yourself via NSURL loading and NSXML.

Thanks Shane for your reaction.
I think this goes a bit further than my understanding of these techniques.
I hoop somebody has done something already on this subject and it should help me a lot if there was some code available (example) to start with.

Search on Cocoa and soap – it looks like there’s a bit of stuff around.

Thanks Shane,
I solved my problem and built a new soap calling version using:

set {xmlResponse, errmsg} to current application’s NSURLConnection’s sendSynchronousRequest_returningResponse_error_(request, missing value, reference)

There is also an option that can work asynchronously with delegate methods.

Of course you have to build the request and the the headers, but that is no problem.

There is a lot to find on the web. But you have to understand the problem and create the solution.
The hint is a good start.

if possible, that’s what you should use. Otherwise you risk spinning cursors.

Glad to hear you found what you needed.