服务端wsdl定于如下:
<element name="doSelect”>//doSelect 为调用的方法
<complexType>
<sequence>
<element name="sid" type="xsd:int"/>
<element name="objectType" type="xsd:string"/>
<element name="whereClause" type="xsd:string"/>
<element name="maxRows" type="xsd:int"/>
<element name="attributes" type="impl:ArrayOfString"/>
</sequence>
</complexType>
</element>
<element name="doSelectResponse”>//调用返回定义
<complexType>
<sequence>
<element name="doSelectReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
//调用方法中一个参数定义(attributes)
<complexType name="ArrayOfString">
<sequence>
<element maxOccurs="unbounded" name="string" type="xsd:string"/>
</sequence>
</complexType>
以上都是服务端定义,没有服务端代码。其中一个参数attributes,type="impl:ArrayOfString" 不知道怎么传入,尝试了几种方法没有解决。
以下是代码:
SoapObject request = new SoapObject(data.getServiceNameSpace(),"doSelect");
request.addProperty("sid", “26354758596”);
request.addProperty("objectType", "wf");
request.addProperty("whereClause", "assignee.last_name=‘liming’ AND status='PEND'");
request.addProperty("maxRows", 100);
request.addProperty("attributes”,_null); //此处问题所在!!!!!!
SoapSerializationEnvelope envelope;
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransportSE transport = new HttpTransportSE(data.getServerUrl());
transport.debug = true;
//调用WebService
try {
transport.call(null, envelope);
if (envelope.getResponse() != null)
{
SoapObject loginresopnse = (SoapObject)envelope.bodyIn;
String retStr = loginresopnse.getProperty("doSelectReturn").toString();
Log.d("debug",retStr);
return true;
}
return false;
} catch (IOException e) {
Log.d("debug","in IOException");
Log.d("info",e.getMessage());
return false;
} catch (XmlPullParserException e) {
Log.d("debug","in XmlPullParserException");
Log.d("info",e.getMessage());
return false;
}