-2

Hi Want display soap web services in Android by using ksoap2. I am using the following code . When I am testing in the Soap Ui Pro it shows ouput xml fine.

httpTransport.call(SOAP_ACTION, envelope);
Object result = (Object) envelope.getResponse();
System.out.println("The Result"+result);

but I am getting the Exception in my Eclipse Logcat, how can I overcome this in Android

Exception :

05-25 15:13:15.105: WARN/System.err(1160): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://www.w3.org/2001/12/soap-envelope}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style'>@1:686 in java.io.InputStreamReader@40546438) 
05-25 15:13:15.115: WARN/System.err(1160):     at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)

Please help me.

Jainendra
  • 24,713
  • 30
  • 122
  • 169
user1414667
  • 91
  • 1
  • 1
  • 4

2 Answers2

0

You are actually getting InputStream in response, you just has to convert it into the String and then you would be able to display it.

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
0

Use Following Code:-

try {
    httpTransport.call(SOAP_ACTION, envelope);
    sb.append(httpTransport.requestDump);
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (XmlPullParserException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}


InputSource inStream = new InputSource();
inStream.setCharacterStream(new StringReader(sb.toString()));

if u have any query than tell me.

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128