私は以下のようにWebサービスを呼び出しています:パーサーエラーエラードメイン= NSXMLParserErrorDomainコード= 4 "操作を完了できませんでした。"
-(void)verifyEmailAndPasswordWebservices
{
NSString *MD5Password = [ self MD5];
NSLog(@"text field password %@",txt_Password.text);
NSLog(@"converted password %@",MD5Password);
NSString *soapMsg =[NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"http://php:8393/includes/webservice\">"
"<SOAP-ENV:Body>"
"<ns1:LoginUserRequest xmlns:ns1=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<email xsi:type=\"xsd:string\">%@</email>"
"<pass xsi:type=\"xsd:string\">%@</pass>"
"</ns1:LoginUserRequest>"
"</SOAP-ENV:Body>"
"</SOAP-ENV:Envelope>",txt_EmailOrMobile.text,MD5Password];
//---print it to the Debugger Console for verification---
NSLog(@"soapMsg..........%@",soapMsg);
NSURL *url = [NSURL URLWithString:@"http://10.0.0.115:8393/includes/webservice/login1.php"];
req = [NSMutableURLRequest requestWithURL:url];
//---set the headers---
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMsg length]];
[req addValue:@"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[req addValue:@"http://10.0.0.115/includes/webservice/login1.php/LoginUser" forHTTPHeaderField:@"SoapAction"];
[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];
//---set the HTTP method and body---
[req setHTTPMethod:@"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
// [activityIndicator startAnimating];
conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];
if (conn)
{
webData = [[NSMutableData data] retain];
}
}
を私はそれは私に次のようなエラー与える応答を取得する場合:
がDONEを。受信したバイト:422 は、XML(null)を示し パーサエラーエラードメイン= NSXMLParserErrorDomainコード= 4「操作を完了できませんでした(NSXMLParserErrorDomainエラー4)。」私は上のかなりを検索した
インターネット。しかし何も見つけることができません。これについての助けてください。
はこれを行い、あなたの符号化方式にこのコードを試してみてください彼が送信している応答をチェックするためにWebサービスの人に話す必要があるという意味ですか?同じWebサービスもAndroidアプリケーションで動作しています。 – Rushi
私は自分の答えに追加しました。本当に問題があるかどうか教えてください。 –
私のコードから次の行を削除しました: if(conn) { webData = [[NSMutableData data] retain]; } 今すぐ機能を以下にweData変数を充填イム: - (無効)接続:(NSURLConnection *)接続didReceiveData:(NSDataの*)データ それはもう与えNSXMLParserErrorDomainエラー4.ません。しかし、それは今、次のエラーを与えています。 パーサエラーエラードメイン= NSXMLParserErrorDomainコード= 5 "操作を完了できませんでした(NSXMLParserErrorDomainエラー5)。" イム使用してPHPのWebサービスを – Rushi