Take the 2-minute tour ×

I'm trying to connect to a web service, with the next code:

WSMethodInvocationRef soapCall;
NSString *methodName;
NSMutableDictionary *params;
NSDictionary *result;

soapURL = [NSURL URLWithString:@"http://wicaweb2.intec.ugent.be:80/FaceTubeWebServiceService/FaceTubeWebService?WSDL"]; 
methodName = @"getMostViewed"; 

soapCall = WSMethodInvocationCreate((CFURLRef)soapURL,
                     (CFStri ngRef)methodName, kWSSOAP2001Protocol); 

params = [NSMutableDictionary dictionaryWithCapacity:2]; 
[params setObject:@"1" forKey:@"arg0"]; 
[params setObject:@"all_time" forKey:@"arg1"]; 
NSArray *paramsOrder = [NSArray arrayWithObjects:@"arg0",@"arg1", nil];



result = (NSDictionary*)WSMethodInvocationInvoke(soapCall); 

NSString *resultado = [result objectForKey: (NSString*)kWSMethodInvocationResult]; 

But I obtain the same reply, than if I don't send parameters.

I got this:

[Session started at 2009-07-07 22:01:53 +0200.]
2009-07-07 22:01:57.669 Hello_SOAP[6058:20b] Result:{

Exactly, seems like this but I will show you also the parameters that the method needs:

SOAP Request

> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ns1="http://webservice.facetube.wica.intec.ugent.be/">
>     <soapenv:Body>
>         <ns1:getMostViewed>
>             <arg0>1</arg0>
>             <arg1>all_time</arg1>
>         </ns1:getMostViewed>
>     </soapenv:Body> </soapenv:Envelope>

As you can see, the name of the parameters that I need are arg0 and arg1, for this I can't understand what is going wrong :)

share|improve this question

2 Answers 2

Try posting the reply you get. It seems like you're parameters are incorrect, given that you get the same response as if you sent no parameters.

share|improve this answer

Danger. Are you are aware that WSMethodInvocationRef (or any of the SOAP helper classes) do not exist on the iPhone? (your question is tagged as iPhone).

It will compile for the simulator but not for the phone. I'd hate to see you waste much time getting this working if your real target is the device and not the Mac.

Instead use wsdl2objc.

Who knows, that may well solve your problem - since it's a stub generation approach it probably will work fine.

If possible though, I'd recommend using REST for server communication instead of SOAP. Depends on what control you have over the server.

share|improve this answer

Your Answer

