Skip to content Skip to sidebar Skip to footer

How To Resolve Soap Fault In Ksoap2?

I am trying to hit a web service with an android application. I am getting following exception about which I don't have any Idea. Please help: 09-01 11:21:29.873: WARN/System.err(9

Solution 1:

If you have soapfault you need to parse the answer by hand :( on your exception

catch (Exception e) {
                e.printStackTrace();
            }

and I think you using old version of ksoap2 :( http://code.google.com/p/ksoap2-android/

this gives you the answer then you can use sax parser or other to parse your answer:

androidHttpTransport.responseDump;

if you find other way to do these please tell me I would be appreciated.

Solution 2:

Check your property names in android are the same with web service side .

For example .

PropertyInfo pi = new PropertyInfo();
pi.setName("name");
pi.setValue(t);
pi.setType(t.getClass());

your paramater name "name" may not same in web service method. Check Out !

Solution 3:

I use the following method:

/**
 * Method to retrieve the errorMessage from the given SoapFault.
 * @param soapFault
 * @return String representing the errorMessage found in the given SoapFault.
 */privatestatic String getSoapErrorMessage(SoapFault soapFault) {
    String errorMessage;
    try {
        NodedetailNode= soapFault.detail;
        ElementfaultDetailElement= (Element)detailNode.getElement(0).getChild(1);
        ElementerrorMessageElement= (Element)faultDetailElement.getChild(0);
        errorMessage =  errorMessageElement.getText(0);
    }
    catch (Exception e) {
        e.printStackTrace();
        errorMessage = "Could not determine soap error.";
    }
    return errorMessage;
}

Post a Comment for "How To Resolve Soap Fault In Ksoap2?"