开发者

WCF - ClientMessageInspector error reporting

开发者 https://www.devze.com 2023-03-16 16:30 出处:网络
I\'m writing a web service at the moment, with a custom behaviour for validating input messages against an XML schema. However, I don\'t understand how I can report any of those errors back to the cli

I'm writing a web service at the moment, with a custom behaviour for validating input messages against an XML schema. However, I don't understand how I can report any of those errors back to the client as SOAP faults.

I've extended the IClientMessageInspector and IDispatchMessageInspector 开发者_StackOverflowto intercept and validate the messages, and am catching validation errors in a validation event handler. The problem comes here: when I throw a new FaultException at this point, it goes unhandled and crashes; using both a code client and the WCF Test Client.

Any advice?

Thanks


You can use IErrorHandler to customize the response which is returned when an exception occurs.

0

精彩评论

暂无评论...
验证码 换一张
取 消