石鹸リクエスト/応答アプリケーションをやってます。 SOAP応答を構築しているうちに、「サーバーがHTTPヘッダーSOAPActionの値を認識しませんでした」というメッセージが表示されます。soap response error
これはどういう意味ですか?そして、これを解決する方法は?
ここにコードがあります。
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"
"<SignOn xmlns=\"http://10.12.50.99/CUTechWebservices/CuTechWebService.asmx\">\n"
"<DeviceID>4A6B740C-0B5B-5F8C-8694-1EC0196C1C67</DeviceID>\n"
"<UserID>10827</UserID>\n"
"<CrID>6</CrID>\n"
"<UserPin>777777!</UserPin>\n"
"</SignOn>\n"
"</soap:Body>\n"
"</soap:Envelope>\n"];
NSLog(@"%@",soapMessage);
//Soap request.
NSURL *url = [NSURL URLWithString:@"https://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx"];
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://10.12.50.99/CUTechWebservices/CuTechWebService.asmx" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
私はこれを試しました。今回は「リクエストが処理できません」というエラーが表示されます。「https://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx?op=SignOn」というアクションは認識されませんでした。 –
アクションとして 'http:// 10.12.50.99/CUTechWebservices/CuTechWebService.asmx/SignOn'を試してください。私はhttps://mobile.areafinancial.com/cutechservice/cutechwebservice.asmx?WSDLをダウンロードし、soapAction文字列を検索して見つけました。 –
@peterこれは私が実際にしたものです。そしてそれは完璧に働いています。ご協力いただきありがとうございます –