【发布时间】:2018-07-26 13:47:45
【问题描述】:
我正在为现有系统编写wsdl 文件。我想将 cmets 添加到生成的请求中。
例如:
<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 时能够看到这些cmets,但在从WSDL 生成请求时却看不到。
已经查看了注释,但我无法使用它们来创建我想要的结果。 (可能是我这边的错误)
【问题讨论】:
-
您可以使用 xsd:documentation 标签将文档添加到您的 xsd。请参阅此链接w3schools.com/xml/el_documentation.asp。这是记录您的请求、回复和结构的标准方式。但它不会出现在请求中。
-
@Namphibian 我明白了。所以不可能将 cmets 添加到生成的请求中?
-
不是。但是,您可以使用一些 xslt 和这些注释来生成一些关键文档。
-
@Namphibian 请将其写为答案,以便我接受。
-
我已经这样做了。