在android中请求和解析列表响应数据SOAP

时间:2013-07-04 06:52:55

标签: android parsing soap ksoap2 android-ksoap2

我还是android和SOAP webservice的新手......

我想问一下在我的网络服务中提供请求和解析报告。

以下是原始网络服务请求

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
  <soapenv:Header/>
  <soapenv:Body>
      <urn:ZfmGenerateUuid>
          <IvNumber>?</IvNumber>
          <OListUuid>
            <!--Zero or more repetitions:-->
            <item>
                <NoHandle>?</NoHandle>
                <Uuid>?</Uuid>
                <Uuid2>?</Uuid2>
            </item>
          </OListUuid>
      </urn:ZfmGenerateUuid>
  </soapenv:Body>
  </soapenv:Envelope>

如果我们设置IvNumber = 4,并且NoHandle,Uuid和Uuid2没有这样的输入

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
      <soapenv:Header/>
      <soapenv:Body>
          <urn:ZfmGenerateUuid>
              <IvNumber>4</IvNumber>
              <OListUuid>
                 <!--Zero or more repetitions:-->
                 <item>
                    <NoHandle></NoHandle>
                    <Uuid></Uuid>
                    <Uuid2></Uuid2>
                 </item>
              </OListUuid>
         </urn:ZfmGenerateUuid>
     </soapenv:Body>
     </soapenv:Envelope>

结果将是这样的

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <n0:ZfmGenerateUuidResponse xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
         <OListUuid>
             <item>
                <NoHandle>1</NoHandle>
                <Uuid>080027F5350A1ED2B98EBC7B96440955</Uuid>
                <Uuid2>080027f5-350a-1ed2-b98e-bc7b96440955</Uuid2>
            </item>
            <item>
                <NoHandle>2</NoHandle>
                <Uuid>080027F5350A1ED2B98EBC7B96442955</Uuid>
                <Uuid2>080027f5-350a-1ed2-b98e-bc7b96442955</Uuid2>
            </item>
            <item>
                <NoHandle>3</NoHandle>
                <Uuid>080027F5350A1ED2B98EBC7B96444955</Uuid>
                <Uuid2>080027f5-350a-1ed2-b98e-bc7b96444955</Uuid2>
            </item>
            <item>
                <NoHandle>4</NoHandle>
                <Uuid>080027F5350A1ED2B98EBC7B96446955</Uuid>
                <Uuid2>080027f5-350a-1ed2-b98e-bc7b96446955</Uuid2>
            </item>
         </OListUuid>
      </n0:ZfmGenerateUuidResponse>
   </soap-env:Body>
   </soap-env:Envelope> 

是否有任何教程或代码可以让我发出请求并使用SOAP?

感谢您的帮助...

1 个答案:

答案 0 :(得分:0)

请在以下主题中查看Android training site

Performing Network Operations
Parsing XML Data

有关SOAP请求的更多答案,请查看以下问题:"Android WSDL/SOAP service client"