如何在android中发送请求并从soap获取响应

时间:2014-04-20 13:07:22

标签: java android soap ksoap2 android-ksoap2

我是Android新手。 我正在使用soap进行webservice,我正在尝试匹配来自请求的数据并希望得到响应。我在android中实现了soap demo但没有通过tag获取数据。 我在这里粘贴肥皂法。

POST /InflAirBook.asmx HTTP/1.1
Host: airwebservice.ezeeibe.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "InFLAirBookService/InflAirGDSLCCAvail"

<?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>
    <InflAirGDSLCCAvail xmlns="InFLAirBookService">
      <AccountID>string</AccountID>
      <AccountPassword>string</AccountPassword>

    </InflAirGDSLCCAvail>
  </soap:Body>
</soap:Envelope>

HTTP / 1.1 200好的 Content-Type:text / xml;字符集= utf-8的 内容长度:长度

<?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>
    <InflAirGDSLCCAvailResponse xmlns="InFLAirBookService">
      <InflAirGDSLCCAvailResult>string</InflAirGDSLCCAvailResult>
    </InflAirGDSLCCAvailResponse>
  </soap:Body>
</soap:Envelope>

我的问题是如何为Android解析它?

请帮助我发送请求并获得回复。

提前致谢

2 个答案:

答案 0 :(得分:0)

我会建议Ksoap ..这是链接https://code.google.com/p/ksoap2-android/

答案 1 :(得分:0)

尝试这个我应该这样做:

watchCurrentPosition