views:

15

answers:

0

Hello, I have readed your post about SoapMessage. I don't know if you can help me but i have a REST Service POST call that I must consming from my app on IPhone and using your code receive always same error : "The server encountered an error processing the request".

If I use GET calling all is right but with POST data I receive this error. I think that with your solution I can solve but probably there is any thing that in my code...

This is the code of calling :

NSString *soapMessage = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<SOAP-ENV:Envelope \n"
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n"
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" 
"xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
"SOAP ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt; \n"
"<SOAP-ENV:Body> \n"
"<returnStringLength xmlns=\"http://tempuri.org/\"&gt;&lt;s_param&gt;This is my test!!</s_param>"
"</returnStringLength> \n"
"</SOAP-ENV:Body> \n"
"</SOAP-ENV:Envelope>"];




NSURL *url = [NSURL URLWithString:@"http://192.168.1.114:82/Services/Revisioni.svc/xstring"];               
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];             
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];          
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];       
[theRequest addValue: @"http://192.168.1.114:82/Services/Revisioni.svc/xstring" forHTTPHeaderField:@"Soapaction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];     
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];