Je suis en train de se connecter à un service Web, avec le code suivant:iPhone service Web
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);
Mais j'obtenir la même réponse, que si je n'envoie pas les paramètres.
Je suis arrivé ceci:
[Session started at 2009-07-07 22:01:53 +0200.]
2009-07-07 22:01:57.669 Hello_SOAP[6058:20b] Result:{
}
Exactement, semble comme cela, mais je vais vous montrer aussi les paramètres que la méthode a besoin:
demande SOAP
> <?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/"> > <soapenv:Body> > <ns1:getMostViewed> > <arg0>1</arg0> > <arg1>all_time</arg1> > </ns1:getMostViewed> > </soapenv:Body> </soapenv:Envelope>
Comme vous pouvez le voir, le nom des paramètres que j'ai besoin sont arg0
et arg1
, pour cela, je ne peux pas comprendre ce qui se passe mal :)