These are probably few of the most popular questions on the forums
and in the WCF sessions.
- How
can I make my WCF WSDL same as Asmx WSDL? It looks different even when I use basic http binding with nothing fancy (security, reliable messaging..no WS* of course).
- I’m
doing interop with Java and my stub generator is unable to understand the WSDL
generated by WCF but it works just fine with Asmx WSDL, what am I doing
wrong?
- What binding
should I use which works best for interop?
- Dude,
where are my types?
etc...
In short, the answer is, there is no silver bullet when it
comes to interop. There are several case by case things you’d need to consider
when trying to make your contracts visible to outside world. Having said that,
there are best practices you can follow which I’d cover in this and upcoming
blog posts.
The WSDL
generated via WCF is different from traditional ASMX WSDL because they have split the schema into multiple
segments (WSDL0, WSDL1....). This is the reason why when you look at the WSDL, you'll notice that the types
seem to be missing! The stub building tools which come with other servers (Weblogic
6.0 for example) do not yet know this and do not iterate through the links specified
in the schema by default, therefore you would not be able to make proxies out
of it.
One of the big benefits of using WCF meta-data generation engine is that you
can get XSD’s out of it too. Other platforms (read Java) tools understand and
prefers XSD's (even though WSDL is the standard, XSD’s are cleaner IMHO). You
can now easily generate them via a WCF service like follows.
- service.svc?xsd=xsd0
- service.svc ?xsd=xsd1
- service.svc?xsd=xsd2
Each of these xsd's has separated out contract, type and
type definition.
Similarly you'd have WSDL0, WSDL1 and WSDL2 so
- service.svc?wsdl=wsdl0
- service.svc?wsdl=wsdl1
- service.svc?wsdl=wsdl2
Again, the wsdl's
are separated to keep the contract, type and type definition (what is a double
in interop environment) apart and not in giant one big file, which seems to be
much easier but in essence its not.
Improving
WCF Interoperability: Flattening your WSDL is an excellent
article by Christian Weyer on increasing the interop bar. It explains the reasoning
behind why a simple basic http binding service based WCF generated WSDL cannot
communicate with its Java counterparts anymore and how to fix this problem.
In the next part I’ll discuss and share some
examples and code samples.