Monday, June 02, 2008

Web Services Contract First doesn't guarantee Interop always

I found this very good article that answered part of the questions I had on my previous post.
The part that is enlightening regarding WSCF as how despite that it might be less productive than Code-first, might offer better Interop in the long run is:

What? Code-first is interoperable?

Well sure! You generate schema from code, proxies consume schema and generate a representation of the schema for the caller’s platform. Of course the serialized type has to be meaningful to the caller, so a DataSet in .NET though serializable makes a horrible candidate for cross platform interoperability. Aside from this, one of the biggest interoperability issues between platforms has to do with runtime schema support. Schema is a vast standard that has much more capability than many parsers have support for. Thus, interoperability can be an issue whether you begin with schema (contract-first) or when you generate schema from objects (code-first).


Ok, ok, the article is dated 2005, but don't be too hard on someone who has been doing windows forms and CAB for the past year :-p
Designing Service Contracts with WCF

Labels: ,

Saturday, May 31, 2008

Web Services Contract First???

I know we .NET developers have been spoiled for a while.

We go on VS2005 and create a new web site project, select the type of project as web service and voila, we land on a page where we can start typing new methods for this class and mark them as web methods with a single annotation. VS2005 does all the plumbing for us creating the wsdl and even publishing the web service for us with another click.

But, is this good enough?

If your enterprise is fully .NET, there is no harm, but if you want to inter-operate with other platforms, they might not understand what your WS said...

VS2005 implements WS-I Basic Profile 1.1, but I believe you can still use .NET types such as special collections...that won't have a Java counterpart.

WSCF existed for a long time on the Java world, VS2005 comes with two command line utilities that can serve to the purpose (xsd.exe and wsdl.exe) but, imho, they are hard to use.

You can always request to your manager a license of Altove XMLSpy...
Or go for this freeware tool made by thinktecture:

WSCF

The tool is good if you define all of your types in a single .xsd file. If you have several files with your types and you import from one namespace into one of your schema files, you might have troubles...

Also the pumbling this utility generates is only for SOAP web services, not for REST web services.

I talked to the Java guru in the office and he mentioned that WSCF was long gone from the Java world, with Eclipse, he only had to define his business payload and the plumbing was done for him on any transport protocol he would choose...So they sort of had to define the payload first, not exactly the contract first...

That triggered my curiosity. I wonder if there is anything like it on VS2008 with WCF...

If you know and can lit the path, please comment. I'm planning to play with this on the next few hours.

Happy coding!

Labels: