2

我的 Android 应用程序使用 SOAP 请求,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.calottery.com/">
    <soapenv:Header/>
    <soapenv:Body>
    <ser:GetCurrentGameInfo/>
    </soapenv:Body>
    </soapenv:Envelope>


 When I test this using SOAPUI, I'm getting the Response(edited to minimum details) as ,

<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>
      <GetCurrentGameInfoResponse xmlns="http://services.calottery.com/">
         <GetCurrentGameInfoResult>
            <xs:schema id="CurrentGameInfo" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
               <xs:element name="CurrentGameInfo" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
               <xs:element name="QueryDate" type="xs:dateTime" minOccurs="0"/>
               </xs:element>                           
         </GetCurrentGameInfoResult>
      </GetCurrentGameInfoResponse>
   </soap:Body>
</soap:Envelope>

这是预期的结果。但是当我从 Android 代码中执行此操作时,如下所示,

SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE transport=new HttpTransportSE(URL);
try{
    transport.call(SOAP_ACTION, envelope);
        SoapObject result=(SoapObject)envelope.bodyIn;
        Log.v("Response", result.toString()); 
}
catch(Exception e){         e.printStackTrace();        }

我得到的回应是

anyType{schema=anyType{element=anyType{complexType=anyType{choice=anyType{element=anyType{complexType=anyType{sequence=anyType{element=anyType{}; }; }; }; element=anyType{complexType=anyType{sequence=anyType{element=anyType{};

我尝试了链接中的解决方案,但得到了相同的响应。我在这里做错了什么?这是我正在使用的服务的链接。

4

1 回答 1

1

我解决了这些问题。使用下面链接中给出的解决方案

Looper.prepare() 异常从 SOAP 中提取 XML 数据。我的异步线程中有一条 Toast 消息用于获取 SOAP 响应,当我删除它时一切正常

于 2013-04-26T09:38:19.293 回答