创建在生成的请求中显示的评论? WSDL 肥皂 xml
Creating a comment that gets displayed in generated request? WSDL SOAP xml
我正在为现有系统编写 wsdl
文件。我想为生成的请求添加评论。
例如这个:
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<!--0=likescoffee,1=doesnotlikecoffe-->
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype" />
在生成的请求中应该如下所示:(例如,在 SoapUI 中加载 WSDL 时)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="https://example.com/some.wsdl">
<soapenv:Header/>
<soapenv:Body>
<!--0=likescoffee,1=doesnotlikecoffe-->
<wsdl:CoffeeRequestInput>0</wsdl:CoffeeRequestInput>
</soapenv:Body>
</soapenv:Envelope>
我在打开 WSDL
时能够看到这些评论,但在从 WSDL
生成请求时却看不到这些评论。
已经查看了注释,但我无法使用它们来创建我想要的结果。 (可能是我这边的错误)
简而言之,您无法根据需要在请求中创建文档。但是,您可以从 WSDL 生成非常有用的文档。通过使用 "xsd:documentation" 标签,您可以直接向元素添加文档。
例如
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype">
<xsd:annotation>
<xsd:documentation>
This object is the CoffeeRequestInput object is an Enumeration which can be used to determine is the user sending the request likes coffee or not.
Valid values for the enumeration is as follows:
0 = like coffee
1 = does not like coffee (probably a user not a programmer making a request).
Some other things that you need to document goes here.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
然后您可以使用 Altova StyleForce、LiquidXML 和 OxyGen 等软件生成 PDF、Word 文档或 HTML 页面,其中显示 SOAP 服务和操作以及您的所有评论。
如果您愿意,您可以编写自己的 XLST 将您的 WSDL 和 XSD 转换为一个整洁的 HTML 页面,该页面还记录了您的接口。最好的部分是,当您使用新操作更新 WSDL 时,文档也会更新。
我正在为现有系统编写 wsdl
文件。我想为生成的请求添加评论。
例如这个:
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<!--0=likescoffee,1=doesnotlikecoffe-->
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype" />
在生成的请求中应该如下所示:(例如,在 SoapUI 中加载 WSDL 时)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="https://example.com/some.wsdl">
<soapenv:Header/>
<soapenv:Body>
<!--0=likescoffee,1=doesnotlikecoffe-->
<wsdl:CoffeeRequestInput>0</wsdl:CoffeeRequestInput>
</soapenv:Body>
</soapenv:Envelope>
我在打开 WSDL
时能够看到这些评论,但在从 WSDL
生成请求时却看不到这些评论。
已经查看了注释,但我无法使用它们来创建我想要的结果。 (可能是我这边的错误)
简而言之,您无法根据需要在请求中创建文档。但是,您可以从 WSDL 生成非常有用的文档。通过使用 "xsd:documentation" 标签,您可以直接向元素添加文档。
例如
<xsd:simpleType name="coffeetype">
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0" />
<xsd:enumeration value="1" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="CoffeeRequestInput" nillable="false" type="tns:coffeetype">
<xsd:annotation>
<xsd:documentation>
This object is the CoffeeRequestInput object is an Enumeration which can be used to determine is the user sending the request likes coffee or not.
Valid values for the enumeration is as follows:
0 = like coffee
1 = does not like coffee (probably a user not a programmer making a request).
Some other things that you need to document goes here.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
然后您可以使用 Altova StyleForce、LiquidXML 和 OxyGen 等软件生成 PDF、Word 文档或 HTML 页面,其中显示 SOAP 服务和操作以及您的所有评论。
如果您愿意,您可以编写自己的 XLST 将您的 WSDL 和 XSD 转换为一个整洁的 HTML 页面,该页面还记录了您的接口。最好的部分是,当您使用新操作更新 WSDL 时,文档也会更新。