Thursday, October 16, 2008

WCF & WSE Interoperability


WSE is the previous generation of Microsoft WS-* stack. For this reasons a lot of Microsoft shops are in a need to interop between WSE & WCF. I'm not going to invent the wheel here - there's a great article in MSDN on this.

There is one delicate point I'd like to emphasize. WCF supports WS-Policy which is a way for a service to specify what WS-* requirements it has (e.g. security, attachments). The policy is contained inside the wsdl:

<wsdl:definitions name="Service" targetNamespace="">
 <wsp:Policy wsu:Id="WSHttpBinding_IService_policy">
     <sp:SymmetricBinding xmlns:sp="">

When a WCF client is generated using "Add service reference" the app.config is automatically synchronized with the WS-Policy from the service wsdl.

WSE does not support this usage of WS-Policy in any of its versions. So when a wsdl that was created using WSE is imported using WCF the app.config needs to be updated manually (or via the config editor). One exception is SSL which WCF can identify from the service url.

For a WSE WSDL, WCF generats a basicHttpBinding by default. In most cases a customBinding would be required in order to reach interoperability on the wire using rich security options, soap12 and MTOM.

I recently saw an error that a WSE server returned for a WCF client:

Header for ultimate recipient is required but not present in the message.

A short investigation showed that the WCF client used the auto-generated app.config with its basicHttpBinding. That's why it did't send any WS-Addressing headers as the error indicates. The solution is of course to manually edit app.config and move to an appropriate customBinding.


What's next? get this blog rss updates or register for mail updates!


├Âmer arslan said...

so good article, thanks