WCF with handcrafted WSDL generated no FaultExceptions

Posted by Marcus Hammarberg on January 7, 2009
Stats

This is problem that has haunted us for the good part of the autumn and winter;

early on in our design process we chose to create the WSDL for our services by hand. This decision mainly had to do with that you can express stuff in XSD that WCF-attributes doesn't support, such as string length etc.

Also we were using the ErrorHandlerAttribute found in the excellent book "Programming WCF Services" by Juwal Löwy.

What we saw was that even though we had created the wsdl for handling the fault and their details correct, we didn't get the details over to the client (that is the T of FaultException<T>). We checked the wsdl and the generated client proxy (and it's wsdl) file over and over, and line by line but just couldn't find it.

And finally it dawned on us... It was Mr Löwy's fault ;). Seriously - it was the use of the ErrorHandlerAttribute that caused the problem. The WSDL was correct all along.

The ErrorHandlerAttribute operates on the message level which I understand as; it actually generates the SOAP-message/XML that is returned to the client. Since that SOAP-message wasn't specified in our WSDL we got this problem.

That was really a long way around to get some details back, but I hope and think that it was worth it. At least we learned some interesting stuff about how the WCF inner workings works.



Published by Marcus Hammarberg on Last updated