views:

605

answers:

2

I'm having a problem consuming WCF service requiring custom SOAP headers for methods marked with [OperationContract] attributes. Custom headers cannot be explicitly declared in the service because interface methods are not based on [MessageContract]. As a result When svcutil.exe tries to build client proxies the resulting generated code doesn't contain any objects related to custom headers. My question is can I easily inject the declaration of custom headers into the MEX response so they become available in WSDL provided by the service.

A: 

Give up, it's easier.

Derek Bartram
A: 

The accepted answer in this post demonstrates an endpoint behavior that does what you want:

http://stackoverflow.com/questions/986455/wcf-wsdl-soap-header-on-all-operations

Also, the same concept can be applied via a contract behavior if you want to specify a header per service contract.

WayneC