Forum Xamarin.Android

Webservice SOAP Error handling

DanikRaikhlin.4786DanikRaikhlin.4786 NLMember ✭✭
edited October 2012 in Xamarin.Android


I'm trying to call a soap webservice and i created my webservice to return a SoapException in case user enters invalid data. The service works if user enter correct data. However when invalid data is entered i am expecting to get a SoapException (Or FaultException) but i'm getting InvalidOpperationException with message:

Not supported Content-Type in the response: 'text/html; charset=ISO-8859-1'

Response error message:

  GW fout 500
Interne server fout

I know that 500 error is internal server error so i might havent setup web.config propperly or its something else.

So my question is, how to properly catch errors that are thrown by the webservice?

Thanks in advance!


  • JoeJoe AUMember

    Best to post your calling code. It's all guesswork otherwise.

  • try
    SoapAccount response = service.Register("AKSDKerD1KFKDSqweKK123ASKDKasdWQwKEKDAS1s23ASDK","[email protected]","danik");

            catch ( SoapException  ec)
                tvRegisterOutput.Text = "SoapException " + ec.Message;
            catch ( FaultException ec)
                tvRegisterOutput.Text =  "FaultException " + ec.Message;
            catch ( Exception  ec)
                tvRegisterOutput.Text = "Exception " + ec.Message + ec.StackTrace;

    The first parameter of Register is Apikey which is incorrect so the service is throwing SoapException however all im catchin is Exception.

  • DanikRaikhlin.4786DanikRaikhlin.4786 NLMember ✭✭
    edited October 2012

    soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
    faultstring>System.Web.Services.Protocols.SoapException: Api key is not correct
    at Intest.WSMobile.Register(String key, String email, String password)/faultstring>

    (Note i removed all "<" so it will show the text here)

    This is what the response is so i am expecting SoapException but i get a InvalidOperationException.

    Does anyone know the solution?

  • Found the solution. It was server side fault. I was just raising SoapException however that is not sufficient. This site explains how to do it. Now the SoapException is being raised.

Sign In or Register to comment.