在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 (将#修改为@)