org.xmlpull.v1.XmlPullParserException: expected: START_TAG using ksoap2-android

1,243 views
Skip to first unread message

Pedro

unread,
Apr 27, 2012, 2:33:49 PM4/27/12
to ksoap2-android
Hello, i'm trying to access a WebService and i keep getting this
error.
The error is in the line:


androidHttpTransport.call(SOAP_ACTION,envelope);

Someone knows why?

Manfred Moser

unread,
Apr 27, 2012, 3:11:57 PM4/27/12
to ksoap2-...@googlegroups.com
Do you have a null response? Debug as described in the wiki and
checkout the responsedump.

Pedro

unread,
Apr 27, 2012, 3:29:28 PM4/27/12
to ksoap2-android
sorry, but I don't find how to debug :/
Meanwhile, in the url that i was passing i removed the "?wsdl" in the
end of the file and it seems that it makes the request (no error is
given) but when i try to print the response i get an error.

try {

androidHttpTransport.call(SOAP_ACTION, envelope);

SoapObject result = (SoapObject) envelope.getResponse();
Log.v(TAG, "REQUEST RESULT: " + result.toString());

and i get

04-27 20:26:55.129: WARN/System.err(956): SoapFault - faultcode:
'soap:Server' faultstring: 'argument type mismatch while invoking
public abstract
com.criticalsoftware.wiccore.wise.entities.resources.Equipment
com.criticalsoftware.wiccore.wise.business.webservice.SharedWebService.getEquipment(int)
with params [192].' faultactor: 'null' detail: null

Manfred Moser

unread,
Apr 27, 2012, 4:15:15 PM4/27/12
to ksoap2-...@googlegroups.com
Thats the error message from the server..

Pedro

unread,
Apr 27, 2012, 9:03:36 PM4/27/12
to ksoap2-android
Yes , i know that's an error from the server.
I changed the response method to:

try {

androidHttpTransport.call(SOAP_ACTION, envelope);

SoapObject response = (SoapObject)envelope.bodyIn;

and now the error is 04-28 01:56:05.332: WARN/System.err(305):
java.lang.ClassCastException: org.ksoap2.SoapFault

The requestdump is:
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://
schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://
schemas.xmlsoap.org/soap/envelope/"><v:Header /
><v:Body><n0:getEquipment id="o0" c:root="1" xmlns:n0="http://
webservice.business.wise.wiccore.criticalsoftware.com/"><arg0
i:type="d:string">192</arg0></n0:getEquipment></v:Body></v:Envelope>

and the response comes with error. I'm calling the method getEquipment
and i add a property using: request.addProperty("arg0",
"192");

Don't know why i get this SoapFault ..

Sergej Koščejev

unread,
Apr 29, 2012, 8:12:02 AM4/29/12
to ksoap2-...@googlegroups.com
On Saturday, April 28, 2012 3:03:36 AM UTC+2, Pedro wrote:
and now the error is 04-28 01:56:05.332: WARN/System.err(305):
java.lang.ClassCastException: org.ksoap2.SoapFault

Don't know why i get this SoapFault ..

It's just the standard message of ClassCastException, the name of the class that could not be casted. If the server returns an error for your request, envelope.bodyIn will be a SoapFault instance, not a SoapObject. So you get an exception on the line where you cast bodyIn to SoapObject.

Manfred Moser

unread,
Apr 30, 2012, 1:58:04 PM4/30/12
to ksoap2-...@googlegroups.com
A good approach is to just do something along these lines (pseudo code)

Object response = envelope.getResponse();

if (response instanceof SoapFault) {

} else if (response instanceof SoapPrimitive) {
// some webservices just return this..
} else if (response instanceof SoapObject) {
// do the normal parsing.
}

manfred

Manfred Moser

unread,
Apr 30, 2012, 2:34:31 PM4/30/12
to ksoap2-...@googlegroups.com
Also... dont use bodyIn directly .. call getResponse().
Reply all
Reply to author
Forward
0 new messages