简体   繁体   English

如何从xsd创建wsdl

[英]How to create wsdl from xsd

I want to create a wsdl by using 3 xsd-files. 我想使用3个xsd文件创建一个wsdl。 How do you that? 那你怎么样?

I tried this in the command prompt: 我在命令提示符下尝试了这个:

wsdl.exe /language:cs /parameters: c:\myService\Contract\HeaderData.xsd c:\myService\Contract\MyData.xsd c:\myService\Contract\Messages.xsd /out: MyWsdl.wsdl

What do I wrong? 我错了什么?

I believe that there's a misunderstanding here. 我相信这里存在误解。 Most likely the wsdl.exe in your illustration refers to Microsoft's tool , which is described as: 很可能你插图中的wsdl.exe是指微软的工具 ,它被描述为:

The Web Services Description Language tool generates code for XML Web services and XML Web service clients from WSDL contract files, XSD schemas, and .discomap discovery documents . Web服务描述语言工具从WSDL合同文件,XSD架构和.discomap发现文档 生成 XML Web服务和XML Web服务客户机的代码

From what you seem to imply by asking the output to be a WSDL file, I can safely assume that you really try to create a WSDL file starting from XSD files. 通过将输出视为WSDL文件,您似乎意味着,我可以安全地假设您真的尝试从XSD文件开始创建WSDL文件。 Below I am trying to explain why you cannot do that that easy, and what options you have. 下面我试图解释为什么你不能这么简单,你有什么选择。

The diagram below shows you the model behind the WSDL 1.1 specification. 下图显示了WSDL 1.1规范背后的模型。

WSDL 1.1 XSD的QTAssistant DataSet视图

Your XSDs fit exactly, and only under types . 您的XSD完全适合,并且仅适用类型 It WSDL terms, types represent your type system used to describe the parts that make up messages, which are then used to describe input/output and faults of operations organized as ports (abstract interfaces) bound to application/transport protocols, and ultimately made (physically) accessible as services at one or more network endpoints. 它的WSDL术语, types代表用于描述构成消息的部分的类型系统,然后用于描述组合为绑定到应用程序/传输协议的端口(抽象接口)的操作的输入/输出和故障,并最终制作(在物理上可作为一个或多个网络端点的服务访问。

To generate WSDL(s) out of XSD(s), you realized by now that you need to provide some more data to a tool that would automatically generate a WSDL for you. 要从XSD生成WSDL,您现在意识到需要为可以自动为您生成WSDL的工具提供更多数据。 For example, what operations you want to describe in your WSDL? 例如,您要在WSDL中描述哪些操作? For each one of them, what's the input, most likely the output and maybe one or more faults? 对于它们中的每一个,输入是什么,最有可能是输出,也可能是一个或多个故障? How would you group them (portType = interface)? 你如何对它们进行分组(portType = interface)? What binding do you want to use: HTTP, SOAP? 你想要使用什么绑定:HTTP,SOAP? What version of SOAP? 什么版本的SOAP? SOAP over: HTTP, MQ? SOAP over:HTTP,MQ? SOAPAction? SOAPAction的? How many WSDL files: 1, or maybe 3? 多少个WSDL文件:1个,或者3个?

Some tools may ask you a series of questions (data entry/wizards) along the above lines and then create the WSDL(s) for you. 有些工具可能会在上面的行中向您询问一系列问题(数据输入/向导),然后为您创建WSDL。 Others, use predefined patterns in the implementation of XSD schema constructs (for example, IFX has a certain way to define Request/Response elements) so based on those assumptions a specialized tool such as QTAssistant (I am associated with it) would ask you less questions, while still creating the WSDLs. 其他人,在XSD架构构造的实现中使用预定义模式(例如, IFX有某种方式来定义请求/响应元素)所以基于这些假设, QTAssistant (我与之关联)等专门工具会让你少见问题,同时仍在创建WSDL。

I remember one or two online tools that were able to allow the user to upload XSD files and then create WSDL after prompting you a couple of questions, but I can't seem to find them anymore... kind of like this one ... 我记得有一两个在线工具能够允许用户上传XSD文件,然后在提示你几个问题之后创建WSDL,但我似乎无法再找到它们......有点像这样的 .. 。

From my understanding, you don't go xsd->wsdl, but I could be wrong. 根据我的理解,你不要去xsd-> wsdl,但我可能是错的。

Generating a WSDL from an XSD file might help clear it up for you though. 从XSD文件生成WSDL可能有助于为您清除它。

You cannot auto-generate a WSDL from an XSD in this manner. 您无法以这种方式从XSD自动生成WSDL。 In order to create the WSDL, you need to start with a new WSDL and import this XSD. 要创建WSDL,您需要从新的WSDL开始并导入此XSD。

The XSD defines the types of data that are available for services. XSD定义了可用于服务的数据类型。 Some XSD is usually embedded in a WSDL, some are imported specifically. 有些XSD通常嵌入在WSDL中,有些是专门导入的。

An alternate way is to use the XSD in C# to generate a service, and then extract the concrete WSDL from that service, but this is not preferred as many teams prefer contract first web services . 另一种方法是使用C#中的XSD生成服务,然后从该服务中提取具体的WSDL,但这不是首选,因为许多团队更喜欢合同优先的Web服务

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

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