我正在开发 ColdFusion SOAP Web 服务,但我不知道如何将注释子元素和文档子元素添加到生成的 WSDL。
这是我的预期输出:
<xsd:element name="country" minOccurs="1" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>The ISO 3166-1 alpha-2 country code
</xsd:documentation>
</xsd:annotation>
....
</xsd:element>
我的 ColdFusion 生成的 WSDL 如下所示:
<xs:element minOccurs="0" name="country" nillable="true" type="xs:string"/>
我在 cfcomponent > cffunction 中定义了参数,如下所示:
<cfargument name="country" type="string" required="true" default="" hint="The ISO 3166-1 alpha-2 country code"/>
使用提示属性不会添加注释和文档子元素,但我在 ColdFusion 文档中找不到另一种方法来实现此目的。
在寻找答案时,我发现 ColdFusion SOAP Web 服务被描述为“半生不熟”。我这样做是否会让自己陷入失败?
最佳答案
如果您想控制 ColdFusion 生成的 WSDL,您可以使用 cfcomponent
标记的 wsdlfile
属性来使用预定义的 WSDL 文件,而不是使用ColdFusion 生成的 WSDL 文件。
来自Producing WSDL files页面:
For complete control of the WSDL, advanced users can specify the cfcomponent wsdlFile attribute to use a predefined WSDL file.
来自cfcomponent documentation page :
wsdlfile - Optional - A properly formatted WSDL file to be used instead of WSDL generated by ColdFusion.
很可能您需要稍微尝试一下才能获得您想要的输出。我不久前将这个答案发布到另一个类似的问题 - https://stackoverflow.com/a/17174756/1636917请注意此处发布的有关端点 URL 需要位于 WSDL 内的评论。
关于web-services - 将注释和文档子元素添加到 Coldfusion 生成的 WSDL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37173140/