hi, i am programming a client in objectiv-c for the iphone which should use Soap for the communication with the .Net server.
I have a big problem and hope that somebody can help me. I send a request with no errors and get a response, but a false response. in my request i put paramters calles "wo"(= where) and "was" (=what), but the response ignore my paramters and do not filter the response, so i do not get the answer i want. if i check the transfer protocol with the tool "charles" it shows me that the parameters exists in the request.
Here my code:
NSString *soapMessage = [NSString stringWithFormat:
@"<\?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<\soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<\soap:Body>\n"
"<\GetBetriebeByWasWo xmlns=\"http://www.hierbinichgast.de/ \">\n"
"<\was>Pizza</was>\n"
"<\wo>homburg</wo>\n"
"<\kuche></kuche>\n"
"<\fachabteilung></fachabteilung>\n"
"<\features></features>\n"
"<\sterne></sterne>\n"
"<\/GetBetriebeByWasWo>\n"
"<\/soap:Body>\n"
"<\/soap:Envelope>\n"];
NSLog(soapMessage);
NSURL *url = [NSURL URLWithString:URL];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];
[theRequest addValue: @"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest addValue: @"http://www.hierbinichgast.de/GetBetriebeByWasWo" forHTTPHeaderField:@"SOAPAction"]; //SOAPAction
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if( theConnection )
{
webData = [[NSMutableData data] retain];
}
else
{
NSLog(@"theConnection is NULL");
}
PS: please ignore the "\" in the code sequence "NSString soapMessage" , i put them for the editor, otherwise the editor can not read this sequence,
Thank you for your help
Best Regards Tasci