As I promised – I’ll be blogging about the new features introduced in WCF 4.5 here. Before getting into big features, lets start with a few small gems. The first one is the support for Flat WSDL!
Interoperability with non-.NET stacks has always been important to us at WCF and there have been instances where some such clients haven’t been able to consume the WSDL generated from a WCF service. WCF, by default generates a WSDL in modular format. This means that the WSDL document specifies its dependencies via xsd:import attributes. Schema types in particular are always generated as separate XSD files. If you look at a typical WSDL file generated by a WCF service – here is what you will notice near the top section.
Modular WSDL while having its advantages, is not understood by some of the non-.Net stacks leading to interoperability issues. Customers implemented tedious workarounds to make this all work. Not anymore! Enter the support for Flat WSDL in WCF. This means, as you would have guessed by its name, there is a single WSDL document and no external references to schema types or anything else. I am attaching a 4.0 generated modular WSDL and the corresponding flat WSDL with the blog post so that you can compare and see the difference yourself.
What this means:
- Improved interoperability support for all the third party WSDL processing stacks like PHP, Flex, Powerbuilder or Infopath which have been unable in the past to consume a WCF modular WSDL without running into issues.
- No more problems when the xsd:import referred to some internal location because say the WCF service was behind a firewall producing a WSDL with schemaLocations pointing to unresolvable URIs and thereby requiring manual correction in the entire downloaded WSDL and all the referenced files as well. I have done that and it as terrible!
- No more dealing with a whole boatload of files when downloading the metadata from a complex service now that the entire metadata is contained within a single WSDL file now.
So, you ask – what do I have to do to take advantage of this fantastic feature – well the answer, as Seinfeld would put it – is “Nothing”. You just enable metadata how you have always done by enabling the serviceMetadata attribute for a 4.5 service and you will see the following “additional” link on your now familiar metadata description page –
You can continue to import the WSDL as you have always done if you do not need the flat WSDL support. However if you do need WSDL in the flat format – you get it from the second link – notice the ?singleWsdl at the end instead of ?wsdl.