views:

229

answers:

2

I have been working with WebServices for sometime. I dealt with many services where XSDs were linked with WSDL for validation and such...

But whenever I get any such requirement, I always used WSDL tool to generate proxy using .wsdl and .xsd files. The type defined in XSD were automatically generated in the proxy.

I know what this tool does. But I am not sure where exactly (which kind of requirement), do we need this tool.

+2  A: 

I have worked on projects where the objects were managed seperately from the interfaces. For example, perhaps a web service was created with a method whose contract looks something like:

Insert(ModeledObject)

The WSDL would understand the schema for ModeledObject, but thats about it. Then another team would manage the XSD for various modeled objects that adhered to the ModeledObject contract. The first team would use wsdl.exe while the second team would make use of xsd.exe.

zac
The business requirement was that the interface be forward and backword compatible and fairly static while supporting a variety of changing data requirements.
zac
Thanks Zac...so when I am generating proxy using wsdl.exe I am getting definition of the class. WHen I am using xsd.exe (probably done by some other team) I am getting same definition. So wouldn't it be a conflict?
noob.spt
They shouldn't be the same class. If you choose to practice contract first web service design (http://www.code-magazine.com/Article.aspx?quickid=0507061) the XSD schema inside your WSDL should be fairly generic, perhaps even using the <xsd:any /> element. Unrelated to your WSDL you can have additional XSD schemas that define more specific objects and use xsd.exe to generate classes for these.
zac
+1  A: 

I use it when dealing with xml directly, outside of web services. When doing document or protocol schema definition for example. I always write the .xsd file first, since it's the most direct description of the model in that context and can be used by a lot of tools. Then I generate the C# classes that go with it with xsd.exe.

Russell Mull