Not able to read a valid xml from a webservice

123 Views Asked by At

I am connecting to a webservice namely service.asmx in android .I am able to connect to the service and get a resonse but i am getting the response as below.The server is sending me a valid xml but i am unable to read the xml properly.The output i am getting is as below

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

and the code used to get response is as below.Does envelope.getResponse will return me a xml format or i need to use something else.I have searched but i'm still unclear with this.

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
        SoapEnvelope.VER11);
SoapObject request = new SoapObject(NAMESPACE, MethName);
envelope.setOutputSoapObject(request);
androidHttpTransport.debug=true;

// Property which holds input parameters
PropertyInfo sayHelloPI = new PropertyInfo();
// Set Name
sayHelloPI.setName("UserId");
// Set Value
sayHelloPI.setValue(1);
// Set dataType
sayHelloPI.setType(int.class);
// Add the property to request object
request.addProperty(sayHelloPI);
//Set envelope as dotNet
envelope.dotNet = true;

try {

    // Invoke web service
    androidHttpTransport.call(SOAP_ACTION, envelope);

    // Get the response
  SoapObject response = (SoapObject) envelope.getResponse();
  System.out.println("response-----------------"+response);
1

There are 1 best solutions below

0
On

Thanks guys ,i used this approach

String ss=httpTransport.responseDump; 

and it gave me a xml in valid format