0
XML 데이터를 웹 서비스로 보내려고합니다. 그러나 나는 서비스에서 응답을 얻지 못하고있다. 내가 SOAPUI를 통해 XML을 보내려고 할 때 ... 난 ... 하나는 내 코드를 확인하고 내가 뭘 잘못에 날 지점하시기 바랍니다 수 있습니다 "수신 매개 변수 failiure"로 오류가 발생했습니다 ..ios 응용 프로그램에서 웹 서비스에 액세스
- (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];
}
코드에서 암호를 제거 할 수 있습니다. 데스크톱 브라우저에서 XML을 서버로 보내 보았습니까? Poster 확장 기능을 갖춘 Firefox와 마찬가지? –
나는 이것에 동의하지 않는다. iphone/objective-c를 통해 웹 서비스에 액세스하는 법을 배우면 정말 도움이되었을 것이다. – AnthonyBlake