Exception propagation from service to client in SOAP calls

extracted from here :

SOAP Exceptions
Exceptions in SOAP responses are returned with an 200 OK HTTP Status so they are deserialized as normal responses in code-generated SOAP clients. The original HTTP Status code is available in the X-Status HTTP Header or SOAP Response Header named X-Status . This is transparently converted into a typed WebServiceException when using ServiceStack’s built-in Soap 1.1/1.2 generic Service Clients as seen in WebServicesTests.

Is there a way to have them returned with a http status code 500 … , so that a vsnet “add service reference” client will generate an .net exception ?

guess i’ll have to write somthing like this

ServiceExceptionHandlers.Add((req, request, ex) =>
{ … }

but what exactly ? thank you

No it can’t be changed to throw a 500 which “Add Service Reference” reads and throws an Exception in the generated client proxy. We’ve ended up settling on this approach as it ended up being the least problematic approach for returning structured Error responses in SOAP.

You can either use ServiceStack’s built-in Soap11ServiceClient or Soap12ServiceClient which transparently converts Error Responses with a ResponseStatus.ErrorCode into a WebServiceException or alternatively you can also check for the X-Status HTTP or SOAP Header in the generated client proxy.