【发布时间】:2013-04-18 09:24:32
【问题描述】:
我正在使用 ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar
我正在做一个需要以下肥皂请求的项目:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="http://www.tmforum.org/xml/tip/model" xmlns:cust="http://www.tmforum.org/xml/tip/customer/cust">
<soapenv:Header/>
<soapenv:Body>
<mod:listProblemsRequest>
<!--Optional:-->
<mod:customer>
<cust:iD >1100000677</cust:iD>
</mod:customer>
</mod:listProblemsRequest>
</soapenv:Body>
</soapenv:Envelope>
但使用 KSOAP2 我能够生成以下请求:
<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>
<retrieveCustomerProfileRequest xmlns="http://www.tmforum.org/xml/tip/model">
<n0:customer xmlns:n0="http://www.tmforum.org/xml/tip/model">
<n1:iD i:type="d:string" xmlns:n1="http://www.tmforum.org/xml/tip/customer /cust">1100000990</n1:iD>
</n0:customer>
</retrieveCustomerProfileRequest>
</v:Body>
</v:Envelope>
如何从 SOAP 请求中删除 i:type="d:string"。
请建议可以在 KSOAP2 的源代码中完成的解决方案或任何解决方法,以便我能够生成适当的请求。
【问题讨论】:
-
如果没有
KSoap库,您不能使用Soap服务吗?有必要用吗? -
@AndroidVogue..是的,因为我得到的 SOAP 响应解析起来非常复杂,所以我需要 ksoap..
-
您可以使用
XML Parsersavailable 解析您的复杂响应 LikeSAXParserXMLPullParserDOMParser如果您在XML中收到响应,并且如果JSON响应仍然可以处理它安卓。我在没有KSOAP库的情况下处理了我的SOAP服务,它运行良好。
标签: android web-services soap ksoap2