微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在KSoap2.0中添加嵌套的soap属性

如何解决在KSoap2.0中添加嵌套的soap属性

我有一个需要使用 ksoap2 向服务器发送数据的 android 应用程序。 我有以下信封,

POST /ws/rps.asmx HTTP/1.1
Host: 192.168.1.10
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/SaveRpsData2"

    <?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>
        <SaverpsData2 xmlns="http://tempuri.org/">
          <AD>
            <SiteID>int</SiteID>
            <SiteName>int</SiteName>
            <SiteLoad>decimal</SiteLoad>
            <SiteCapacity>decimal</SiteCapacity>
            <LoadDate>dateTime</LoadDate>
            <LoadDateTime>dateTime</LoadDateTime>
            <isUpdate>boolean</isUpdate>
            <ProductionQty>decimal</ProductionQty>
            <SiteType>string</SiteType>
          </AD>
        </SaverpsData2>
      </soap:Body>
    </soap:Envelope>

我的问题是 int ,如何将它发送到 android 的soap 对象中。我正在使用

    val propertyInfoTemps = PropertyInfo()
    propertyInfoTemps.setName("SiteID")
    propertyInfoTemps.setValue(110)
    propertyInfoTemps.setType(Integer::class.java)
    soapObject.addProperty(propertyInfoTemps)

我也试过了,

soapObject.addProperty("SiteID",model.SiteID)

有谁知道,如何按照以下格式发送上述信封?

<soapObject>
  <Root_PropertyInfo> //<AD> in my case
     <propertyInfo> Value1   </propertyInfo>
     <propertyInfo> Value2   </propertyInfo>
  </Root_PropertyInfo>
</soapObject>

任何帮助都是可观的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。