iphone開発初心者です。
iPhoneアプリケーションからNSSTRINGをサーバーに送信しようとしています。
次のコード行で
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap12:Body>\n"
"<SaveData xmlns=\"http://tempuri.org/\">\n"
"<xmlstring>%@</xmlstring>\n"
"</SaveData>\n"
"</soap12:Body>\n"
"</soap12:Envelope>\n", StringXml
];
NSLog(@"Soap Messaage......%@",soapMessage);
NSURL *url = [NSURL URLWithString:urlString];
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://tempuri.org/SaveData" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
// [theRequest addValue: StringXml forHTTPHeaderField:@"xmlstring"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
//[theRequest setHTTPBody: [StringXml dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connectionResponse = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
しかし、それは私を返します
すなわち
System.InvalidOperationException: 要求の形式が無効です: text/xml; 文字セット=utf-8。System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() で System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() で
この問題を克服するにはどうすればよいですか?