tags:

views:

276

answers:

2

The FaultContract from my WCF service doesn't have a datacontract members; thus when the service is consumed in BizTalk, the generated schema doesn't show up any members. How do I handle in BizTalk?

While consuming this WCF service from a .NET client, the implementation provides the exception along with Class library ( of data objects) and I catch the fault of that exception type.

A: 

I am not sure if this is possible. But to get it to work biztalk must have access to the dll with your data objects. You could try referencing the dll from your biztalk project.

Shiraz Bhaiji
I can have BizTalk refer that assembly. Will you please guide me further on the implementation...like how do I bind the fault exception (port) to that exception type/schema?
Muralidhar
A: 

If you are consuming the service from an orchestration you could try the following steps:

  1. Add an XSD representation of your FaultContract to the project and use this as message type on your fault operation.

  2. Add an exception handler block to the orchestration using this fault operation as message type

  3. On your two-way WCF SendPort go to the Messages tab and then on 'Inbound BizTalk Message Body' change the radio button to Path.

  4. On 'Body path expression' add something like this:

    /* [namespace-uri()='http://myservice.namespace/'] | /* [local-name()='Fault'] /* [local-name()='Detail']/*

These two xpaths separated by a '|' will make the adapter depending on what it receives publish either the correct service reply or the content of the details node which is where the WCF FaultContract is placed. This will allow the disassembler to work when trying to identify the message.

A side effect of this is that you will have a problem catching SOAP-faults in the orchestration but this is solved by creating a schema representation of a SOAP-fault (http://schemas.datacontract.org/2004/07/System.ServiceModel#ExceptionDetail) and use that as a second fault operation.

magnus