我做.net的刚接触android 希望高手能告诉下我是哪写错了
先上java代码public class HelloService implements ISoapService{
private static final String NameSpace = "http://www.test.com";
private static final String URL = "http://wcftest.3322.org/WebService.svc";
private static final String SOAP_ACTION = "http://www.test.com/HelloService/SayHello";
private static final String MethodName = "SayHello";
private String words;
public HelloService(String words) {
this.words = words;
} @Override
public SoapObject LoadResult() {
SoapObject soapObject = new SoapObject(NameSpace, MethodName);
soapObject.addProperty("name", words);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // 版本
envelope.bodyOut = soapObject;
envelope.dotNet = true;
envelope.setOutputSoapObject(soapObject);
HttpTransportSE trans = new HttpTransportSE(URL);
trans.debug = true; // 使用调试功能
try {
trans.call(SOAP_ACTION, envelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
SoapObject result = (SoapObject) envelope.bodyIn;
return result;
}}
我用wcftestclient调取wcf发送的xml为<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.test.com/HelloService/SayHello</Action>
</s:Header>
<s:Body>
<SayHello xmlns="http://www.test.com">
<name>Master HaKu</name>
</SayHello>
</s:Body>
</s:Envelope>
用eclipse通过断点截取的发送信息为<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<SayHello xmlns="http://www.test.com" id="o0" c:root="1">
<name i:type="d:string">Master HaKu</name>
</SayHello>
</v:Body>
</v:Envelope>
java发送的xml少了一个Action的信息 是不是这里出了问题?如果是的话我需要怎么改
先上java代码public class HelloService implements ISoapService{
private static final String NameSpace = "http://www.test.com";
private static final String URL = "http://wcftest.3322.org/WebService.svc";
private static final String SOAP_ACTION = "http://www.test.com/HelloService/SayHello";
private static final String MethodName = "SayHello";
private String words;
public HelloService(String words) {
this.words = words;
} @Override
public SoapObject LoadResult() {
SoapObject soapObject = new SoapObject(NameSpace, MethodName);
soapObject.addProperty("name", words);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // 版本
envelope.bodyOut = soapObject;
envelope.dotNet = true;
envelope.setOutputSoapObject(soapObject);
HttpTransportSE trans = new HttpTransportSE(URL);
trans.debug = true; // 使用调试功能
try {
trans.call(SOAP_ACTION, envelope);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
SoapObject result = (SoapObject) envelope.bodyIn;
return result;
}}
我用wcftestclient调取wcf发送的xml为<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.test.com/HelloService/SayHello</Action>
</s:Header>
<s:Body>
<SayHello xmlns="http://www.test.com">
<name>Master HaKu</name>
</SayHello>
</s:Body>
</s:Envelope>
用eclipse通过断点截取的发送信息为<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<SayHello xmlns="http://www.test.com" id="o0" c:root="1">
<name i:type="d:string">Master HaKu</name>
</SayHello>
</v:Body>
</v:Envelope>
java发送的xml少了一个Action的信息 是不是这里出了问题?如果是的话我需要怎么改
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货