正在创建一个在生成的请求中显示的注释?WSDL SOAP xml



Im正在为现有系统编写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时,文档也会更新。

最新更新