zz8zz 2017-03-28 09:08 采纳率: 0%
浏览 804
已结题

ksoap访问webservice上送自定义对象如何处理

服务端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;

}

  • 写回答

1条回答

  • zz8zz 2017-03-29 05:28
    关注

    没有人熟悉这方面么?

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?