I am trying to send the XML data to a web service. But i am not getting any responce from the service. when i tried to send the XML through SOAPUI… i got the error as “Incoming parameter failiure”..can any one please check my code and point me on what i am doing wrong..
- (void)viewDidLoad
{
NSString *Message = [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/\"> \n"
"<SOAP-ENV:Body> \n"
"<XMLGetReportParameters xmlns=\"http://PlusDiagnostics.Schemas.GetReportParameters\"><UserName xmlns="">USERNAME</UserName><Password xmlns="">PASSWORD</Password><List xmlns="">All</List></XMLGetReportParameters>"
"</SOAP-ENV:Body> \n"
"</SOAP-ENV:Envelope>" ];
NSURL *url = [NSURL URLWithString:@"https://pathflexstage.plusdx.com/MobileReporting/GetPathologyReports.svc"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [Message length]];
NSLog(@"message length is %d",[Message length]);
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest addValue: @"http://tempuri.org/IGetPathologyReports/GetReports" forHTTPHeaderField:@"soapAction"];
[theRequest setHTTPBody: [Message dataUsingEncoding:NSUTF8StringEncoding]];
NSString *returnString = [[NSString alloc] initWithData:[NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:nil] encoding:NSUTF8StringEncoding];
// NSLog("return");
NSLog(@"%@",returnString);
[super viewDidLoad];
}
You will be receiving something back from the server, possibly an error.
Declare the following;
…and then make your request like so;
…if you then inspect response and error, you should be able to find the route of you problem.