tags:

views:

279

answers:

4

Hello, i have the next problem:

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

NSURL *soapURL;
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];

WSMethodInvocationSetParameters(soapCall, 
     (CFDictionaryRef)params,(CFArrayRef)paramsOrder);

WSMethodInvocationSetProperty(soapCall, 
     kWSSOAPMethodNamespaceURI,
     (CFTypeRef)@"http://webservice.facetube.wica.intec.ugent.be/"); 

result = (NSDictionary*)WSMethodInvocationInvoke(soapCall); 

NSString *resultado = [result objectForKey: (NSString*)kWSMethodInvocationResult]; 
NSLog(@"Result:%@",resultado);

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

Can you help me with this problem?

Thanks

A: 

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.

Dan Lorenc
A: 

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 u also the parameters that the method needs:

SOAP Request

> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:ns1="http://webservice.facetube.wica.intec.ugent.be/"&gt;
>     <soapenv:Body>
>         <ns1:getMostViewed>
>             <arg0>1</arg0>
>             <arg1>all_time</arg1>
>         </ns1:getMostViewed>
>     </soapenv:Body> </soapenv:Envelope>

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

Thanks!!

You should add this to your question as an edit rather than responding to an answer with an answer.
Nosredna
A: 

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.

Kendall Helmstetter Gelner
A: 

thank you very much