erickou1124 / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

org.ksoap2.SoapFault cannot be cast to org.ksoap2.serialization.SoapObject #177

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
SoapSerializationEnvelope envelope = new 
SoapSerializationEnvelope(SoapEnvelope.VER10);  

envelope.bodyOut = rpc;  
envelope.dotNet = true;  
envelope.setOutputSoapObject(rpc);  
HttpTransportSE transport = new HttpTransportSE(URL);       

try {  
    transport.call(soapAction, envelope);  
} catch (Exception e) {  
    e.printStackTrace();  
} 

SoapObject object = (SoapObject) envelope.bodyIn; 

the error is in the last sentence: 
AndroidRuntime(16615): java.lang.ClassCastException: org.ksoap2.SoapFault 
cannot be cast to org.ksoap2.serialization.SoapObject

how to solve it ? please.

btw, i use ksoap2-android V3.1.0

Original issue reported on code.google.com by qin...@gmail.com on 20 Nov 2013 at 1:59

GoogleCodeExporter commented 9 years ago
I think the service is returning an exception. You must cast to SoapFault to 
see the error

if (envelope.bodyIn instanceof SoapFault)
{
    final SoapFault sf = (SoapFault) envelope.bodyIn;
    ... // Stuff
}

Original comment by d.chap...@gmail.com on 27 Jan 2015 at 4:35