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?

About the Author

You may be wondering who I am (or may not!), but I've been in the industry 16+ years working on a variety of systems from IBM mainframes as a CICS systems programmer, to developing on Unix and Windows based systems. At the moment, I'm currently working for a Microsoft Gold Partner in the UK called Solidsoft who specialise in systems integration using BizTalk Server. My position is generally dictated by what I'm doing, but normally as a solutions architect/consultant helping clients with their integration projects involving, yes you guessed it: BizTalk Server.

Disclaimer: all the views expressed here are my own and do not necessarily represent the views of Solidsoft Ltd or indeed any other company.