用ksoap调用肥皂api

时间:2017-02-21 05:09:25

标签: android soap soapui

如何在Android应用中获得正确的响应。我的api原始响应显示在soapUi软件中

// `/status.html` is just a route path it has nothing to do with html files

我称之为api以获得响应

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
  <GetSourcesResponse xmlns="...">
     <GetSourcesResult>
        <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="ITS" msdata:UseCurrentLocale="true">
              <xs:complexType>
                 <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="ITS">
                       <xs:complexType>
                          <xs:sequence>
                             <xs:element name="CM_CityID" type="xs:int" minOccurs="0"/>
                             <xs:element name="CM_CityName" type="xs:string" minOccurs="0"/>
                          </xs:sequence>
                       </xs:complexType>
                    </xs:element>
                 </xs:choice>
              </xs:complexType>
           </xs:element>
        </xs:schema>
        <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
           <DocumentElement xmlns="">
              <ITS diffgr:id="ITS1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
                 <CM_CityID>645</CM_CityID>
                 <CM_CityName>Ahmednagar</CM_CityName>
              </ITS>
              <ITS diffgr:id="ITS2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
                 <CM_CityID>2762</CM_CityID>
                 <CM_CityName>Airoli</CM_CityName>
              </ITS>
           </DocumentElement>
        </diffgr:diffgram>
     </GetSourcesResult>
  </GetSourcesResponse>

如何获得适当的原始回复 请帮助我.....提前谢谢

1 个答案:

答案 0 :(得分:0)

使用 Wsdl2Code tool

这是一个帮助开发人员使用.net Web服务的Web工具。

  1. schemas的{​​{1}}上方打开,另存为 .wsdl 扩展程序
  2. browser上传到file.wsdl
  3. 下载自动生成的代码
  4. 粘贴到包中
  5. 使用Wsdl2Code类进行服务器的读取,写入和更新
  6. 来自服务类

    的示例代码
    Service