NullPointer
NullPointer

Reputation: 496

Incorrect response from SOAP when done programmatically

My Android app uses SOAP request ,

<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>

which is the expected result. But when I do it from Android code, as below,

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();        }

I'm getting a response as

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{};

I tried the solution in link , but got the same response. What am I doing wrong here? Here's the link to the service that I'm using.

Upvotes: 2

Views: 1021

Answers (1)

NullPointer
NullPointer

Reputation: 496

I solved the issues. Used the solutions given in the links below

Looper.prepare() Exception and Extracting XML Data from SOAP . I had a Toast message within in my Async Thread for fetching SOAP Response, when I removed it it's all working fine

Upvotes: 1

Related Questions