我在我的应用程序中使用 SOAP 请求,因为我的 SOAP 请求结构如下:
<Data>
<Keys>
<String>
<V>string</V>
<K>string</K>
</String>
<String>
<V>string</V>
<K>string</K>
</String>
<Keys>
<CriteriaKeys>
<String>
<V>string</V>
<K>string</K>
</String>
<String>
<V>string</V>
<K>string</K>
</String>
</CriteriaKeys>
<No>int</No>
<Size>int</Size>
</Data>
在此我在设置请求的输入时遇到问题。如何使用 addproperty 方法为这种复杂类型设置输入。以下是我的 SOAP 调用代码:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject authentication = new SoapObject(NAMESPACE,"authentication");
Setting property for authentication
request.addSoapObject(authentication);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet=true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION,envelope);
SoapObject result=(SoapObject)envelope.getResponse();
Log.i("myApp",result.toString());
}