System.Exception must be XML serializable to be a message part type

616 views Asked by At

I am connecting to a simple WCF service from my orchestration and the WCFservice throws a system.exception with a custom message. When I add an exception handler at the end of my scope in orchestration, and set the Exception Object Type property to "System.Exception", I cannot build the project, the error I get is

 System.Exception must be XML serializable to be a message part type

I have tried throwing System.Xml.XmlException but the error persists. I am not using faults.

Using VS2012 and BizTalk server 2013.

What could the problem be?

1

There are 1 answers

0
zurebe-pieter On BEST ANSWER

The better option here would be for your WCF Service to throw a SOAP Fault in this case. This can be a general SOAP Fault or a typed fault instead.

See here for more information regarding SOAP Faults: http://www.w3schools.com/webservices/ws_soap_fault.asp

Then, when dealing with SOAP faults in your orchestration, there is a best practice to do this by setting propagate fault message like this:

enter image description here

How to do this, is described clearly in this blog post: http://www.codit.eu/blog/2012/01/13/best-practices-for-handling-web-service-exceptions-in-biztalk-server/

Hope this helps.