Suppose you have to call a SOAP service that doesn’t return typed SOAP faults, but only untyped SOAP faults. In that case, when you hit Add Generated Items / Consume WCF Service, you will get a porttype with operations that only have request and response messages. To catch untyped soap faults, you will have to add a Fault message manually. As the messagetype (of the Fault operation), select Schemas \ From referenced assembly. Select Microsoft.BizTalk.GlobalPropertySchemas and then BTS.soap_envelope_1__1 or BTS.soap_envelope_1__2 (depending on the version of the SOAP service being either SOAP 1.1 or SOAP 1.2). Finally select Fault.
Next you can add a Catch Exception block. As the Exception Object Type, you can now select XedulePort.CreateGroep.Fault, being the fault you just added on the port. Note that you don’t connect the Fault operation in any way to the Exception Handling block. As an example, look at the orchestration snippet below:
In the Catch Exception Block, you can create an ESB fault (Construct shape + Message Assignment) and send it to the database.
(define variable soapFault as System.String)
soapFault = xpath(ex, “string(/*[local-name()=’Fault’ and namespace-uri()=’http://schemas.xmlsoap.org/soap/envelope/’]/*[local-name()=’faultstring’ and namespace-uri()=”])”);
MsgFaultMessage = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();
MsgFaultMessage.Body.FaultCode = “2000”;
MsgFaultMessage.Body.FaultDescription = soapFault;
MsgFaultMessage.Body.FaultSeverity = Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error; Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(MsgFaultMessage, MsgSkb_Medewerker);