Close

WCF - ASMX Interoperability – Best Practices – Part I

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.

Share

5 thoughts on “WCF - ASMX Interoperability – Best Practices – Part I

  1. Very good article. I think it points out a big weakness in WCF in terms of interoperability. Packaging the WSDL into separate files just won't work with many clients. I wasn't entirely happy with the solution on Christian Weyer's page either although it is one way to solve the problem. Ideally one should be able to specify the flat WSDL just through configuration.

    It seems like a step back from asmx in terms in inter-operability. At the end of the day, I think plain old xml and schemas is probably the best answer for true interoperability.

  2. Hey. Vegetarianism is harmless enough, though it is apt to fill a man with wind and self-righteousness.
    I am from Herzegovina and also am speaking English, give please true I wrote the following sentence: "Cel mai mare producator auto din rusia avtovaz si producatorul francez de automobile renault vor incepe asamblarea de noi modele lada in.Vol; sko automobili; gamykla neribotam laikui atid; jo pagrindinio konvejerio paleidim."

    Thanks for the help :P, Briar.

Comments are closed.