Sunday, August 01, 2004
Returning SOAP Faults from an Orchestration Published as a Web Service
I was asked the question recently: how can I return a SOAP fault from a web service call if the orchestration that has been published has failed?
Well, this is seemingly a lot easier than you would think. A request-response port type in orchestration allows multiple Fault Messages to be defined. These fault messages can be based on any message type (for example, System.String) and are returned to the web service in the same manner as returning a response to a web service, that is, via a send shape to the appropriate fault message on the operation defined on the port type.
If you were to take a look at the port type definition in the orchestration view tab in VS.NET, then you'll see the various messages defined on the operation of the port type. Each message has an associated icon that represents the message direction:
- blue arrow for request
- green arrow for response
- red cross for fault
By simply creating the appropriate message and populating it, then sending the message to the fault message of the port, you are able to return SOAP faults to the client of the web service. Easy, eh?