简体   繁体   English

我们在哪里需要XSD.exe

[英]Where do we need XSD.exe

I have been working with WebServices for sometime. 我一直在使用WebServices。 I dealt with many services where XSDs were linked with WSDL for validation and such... 我处理过许多将XSD与WSDL链接进行验证的服务,例如……

But whenever I get any such requirement, I always used WSDL tool to generate proxy using .wsdl and .xsd files. 但是,只要有任何这样的要求,我总是使用WSDL工具使用.wsdl和.xsd文件生成代理。 The type defined in XSD were automatically generated in the proxy. XSD中定义的类型是在代理中自动生成的。

I know what this tool does. 我知道这个工具的作用。 But I am not sure where exactly (which kind of requirement), do we need this tool. 但是我不确定到底需要什么工具(哪种要求)。

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: 例如,也许使用某种方法创建的Web服务的合同如下所示:

Insert(ModeledObject) 插入(ModeledObject)

The WSDL would understand the schema for ModeledObject, but thats about it. WSDL将了解ModeledObject的架构,仅此而已。 Then another team would manage the XSD for various modeled objects that adhered to the ModeledObject contract. 然后,另一个团队将为遵循ModeledObject合同的各种建模对象管理XSD。 The first team would use wsdl.exe while the second team would make use of xsd.exe. 第一小组将使用wsdl.exe,而第二小组将使用xsd.exe。

I use it when dealing with xml directly, outside of web services. 在Web服务之外直接处理xml时,会使用它。 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. 我总是首先编写.xsd文件,因为它是该上下文中对模型最直接的描述,可以被许多工具使用。 Then I generate the C# classes that go with it with xsd.exe. 然后,我使用xsd.exe生成与之配套的C#类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM