使用 glassfish Web 服务测试器测试的 Soap 请求
<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:hello xmlns:ns2="http://WS/">
<name>asd</name>
</ns2:hello>
</S:Body>
肥皂反应
<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:helloResponse xmlns:ns2="http://WS/">
<return>Hello asd !</return>
</ns2:helloResponse>
</S:Body>
现在我尝试在我的 ios 上调用这个 hello 方法,使用 sudz 将“name”参数传递给 web 服务。所以这是createEnvelope里面的代码:
[s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
[s appendString:@"<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"];
[s appendString:@"<S:Header/>"];
[s appendString:@"<S:Body>"];
[s appendString:@"<ns2:hello "];
[s appendString:@"xmlns:ns2=\"http://WS/"];
[s appendString:@"\"/>"];
[s appendString:@"<name>alvin</name>"];
[s appendString:@"</ns2:hello> "];
[s appendString:@"</S:Body>"];
[s appendString:@"</S:Envelope>"];
这是ios访问时的netbeans日志
INFO: Received WS-I BP non-conformant Unquoted SoapAction HTTP header: http://WS/hello
INFO: berhasil null
被android访问时记录
INFO: Received WS-I BP non-conformant Unquoted SoapAction HTTP header: http://WS/hello
INFO: berhasil Cornel
但它总是返回 null 参数,并且在 android 中使用 ksoap 并且它工作得很好。使用上面的那些信封,我可以调用方法(你好),但它传递了 null 参数。请帮忙T_T