ihrthk Boss直聘 Android开发工程师  2012年06月01日
求救---使用soap协议访问webservice。
这是请求的xml.


POST /wifiService/wifiService.asmx HTTP/1.1
Host: 121.205.2.66
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetCenterServer"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetCenterServer xmlns="http://tempuri.org/">
<re>
<IMEI>string</IMEI>
<ProductId>string</ProductId>
<ProductPassword>string</ProductPassword>
<requestType>int</requestType>
</re>
</GetCenterServer>
</soap:Body>
</soap:Envelope>



String method = "GetCenterServer";
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject soapObject = new SoapObject(SERVICE_NS, method);
soapObject.addProperty("re", new Request("11111111", "", "", 1));
/*
* soapObject.addProperty("IMEI", "11111");
* soapObject.addProperty("ProductId", "");
* soapObject.addProperty("ProductPassword", "");
* soapObject.addProperty("requestType", 1);
*///不可以,因为这些属都re标签包上了,请问我怎么封装啊?
envelope.bodyOut = soapObject;
envelope.dotNet = true;
AndroidHttpTransport ht = new AndroidHttpTransport(SERVICE_URL);
ht.call(SERVICE_NS + method, envelope);
Object object = envelope.getResponse();

...全文
53 点赞 收藏 回复
写回复
回复

还没有回复,快来抢沙发~

发动态
发帖子
Android
创建于2009-10-09

4.6w+

社区成员

9.0w+

社区内容

移动平台 Android
社区公告
暂无公告