Tuesday, July 17, 2007

Window Communication Foundation Unleashed - Xml Fetish

I am reading through the copy of "Window Communication Foundation Unleashed" that Craig McMurty, PM in Identity at Microsoft sent me.

I was sent a copy as i made a comment some time ago on integration of Xml Schema constraints with Web Services. I read his argument in the book, but i cannot agree it is the right way to do things.

His argument is to convey the business rules (well, the basic rules initially) through the name of the property. So you may have a property called "QuanityBetween10And1000" rather than define a simpleType in your schema that states that "Quantity" must be a value between 10 and 1000.

His argument is at its core based on the fact that current proxy generation tools (such as Microsoft's xsd.exe) do not go any deeper into the schema than the name and type of the property. What happens if you have two rules, or three?!

IMHO this is a tooling issue. If i create a web service interface and set a simple constraint (complex types are more difficult) then i expect good tools to take this into consideration - i really can't imagine why not!? Especially with the relative overhead of a web services call, the more intelligence that can be put into a proxy generated class, the better... and Xml Schema is cross-platform and cross-language. So ANY language can get these rules. if the proxy generation tool doesn't support it then fine, they get the hit. But most really should.

In fact, in WCF i'd expect a proxy generated class to not only provide a typed and named property, but i'd expect any simpleType definitions to be included. How hard would a check on an integer range be? And it adds a lot of value. Something like BPEL will do this with even more sophistication... so why not put in the beginnings of this.

The book is excellent, but as the point above is probably the reason i got a mention in the book in the first place, i felt i had to write something. I Craig doesn't ask for it back :)

No comments: