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{};
響應我試圖link的解決方案,但得到了同樣的答覆。我在這裏做錯了什麼?這是我正在使用的link to the service。
我使用了[此鏈接](http://stackoverflow.com/questions/16055916/soap-response-not -in-xml-format?rq = 1),現在我得到一個XML響應。但我得到的只是XML文件的一半,然後我得到一個例外04-26 01:47:31.606:W/System.err(3585):java.lang.RuntimeException:無法在線程內創建處理程序沒有調用Looper.prepare()。我已經在使用服務和AsyncTask來獲取SOAP響應。爲什麼我得到這個錯誤? – NullPointer 2013-04-26 02:09:38
PS:我的XML響應非常大,會導致問題嗎? – NullPointer 2013-04-26 02:14:52