Android soapFault Parser

1
Well I'm starting to make error handling that the webService soap returns me, for example if the user enters login or wrong password the web service returns a SoapFault error: user or invalid password. Only I can not get this message and show in Toast to warn about the problem. As I could solve this, for us java happens an exception of try catch.

    
asked by anonymous 02.12.2016 / 11:59

1 answer

1

I decided to use the Web Service method to verify the login as follows:

 if(envelope.bodyIn instanceof SoapFault) {
     strFault = ((SoapFault) envelope.bodyIn).faultstring

 }

And in try catch where the method is called where the error of Exception arrived I called a thread with a toast .

finally {
    runOnUiThread(new Runnable() {
        public void run() {
            Toast.makeText(getApplicationContext(), ws.strFault, Toast.LENGTH_SHORT).show();
        }
    });

    dialog.dismiss();
}
    
02.12.2016 / 13:14