KSoap2发送复杂的XML

时间:2012-12-13 18:44:13

标签: java android object soap ksoap2

我使用Eclipse w / Android Developer Tools(Build:v21.0.0-531062)开发Android应用程序

我正在尝试发送带有XML结构的soap消息,例如

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header/>
<v:Body>
    <n0:GetContent id="o0" c:root="1" xmlns:n0="http://11Giraffes.com/">
        <SerialNum i:type="d:string">aac3691e</SerialNum>
        <ID i:type="d:string">7fc2cf3f8445ca8e3383ea870f3ae2ce</ID>
                    <SysInfo>
                          <IIP i:type="d:string">127.0.0.1</IIP>
                          <CPU i:type="d:string">15%</CPU>
                    <SysInfo>
    </n0:GetContent>
</v:Body>

但是我无法获取应该在SysInfo下嵌套的数据。这一切都进入了“GetContent”命名空间。我试图使用各种ksoap2 jar文件来获取SoapObject.adddSoapObject(),但它们都没有按照定义提取该方法。

我真正得到的是:

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header/>
<v:Body>
    <n0:GetContent id="o0" c:root="1" xmlns:n0="http://11Giraffes.com/">
        <SerialNum i:type="d:string">aac3691e</SerialNum>
        <ID i:type="d:string">7fc2cf3f8445ca8e3383ea870f3ae2ce</ID>
        <IIP i:type="d:string">127.0.0.1</IIP>
        <CPU i:type="d:string">15%</CPU>
    </n0:GetContent>
</v:Body>

Jars尝试:

  • ksoap2-机器人-2.5.2.jar
  • ksoap2-机器人-2.5.5.jar
  • ksoap2-机器人-2.6.5.jar
  • ksoap2-机器人组装-2.5.5-罐与 - dependencies.jar
  • ksoap2-机器人组装-2.6.4-罐与 - dependencies.jar

文档说明任何超过2.5.5的jar都会包含方法“addSoapObject()”,但它没有。

ksoap documentation link在“向请求中添加复杂对象数组”部分

任何帮助确保这一点都是正确的。

0 个答案:

没有答案