1
2012-07-27 20:15:53.523 ProjectDemo[1697:40b] Done. received Bytes 0
2012-07-27 20:15:53.524 ProjectDemo[1697:40b] the xml Data is

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMessage length]];
[theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"ManageCase" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

SOAP エンベロープからの応答が 0 です。

応答が 0 になるケースについてアドバイスをいただけますか。

@前もって感謝します

4

1 に答える 1

1

Content-Type ヘッダー フィールド値に「text/xml; charset=utf-8」を使用してみてください。

また、"http://www.yournamespace.com/ManageCase" など、名前空間全体を SOAPAction ヘッダーの一部として含めてみてください。

SOAP 1.1 Objective-C コード サンプルを次に示します。

NSString *soapAction = @"Login";
NSString *messageLength = [NSString stringWithFormat:@"%d", [message length]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:serverURL];
[request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:[NSString stringWithFormat:@"http://www.namespace.com/%@", soapAction] forHTTPHeaderField:@"SOAPAction"];
[request addValue:messageLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[message dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
于 2012-07-27T20:56:50.220 に答える