向 Coldfusion 生成的 WSDL 添加注释和文档子元素

Adding annotation and documentation child elements to Coldfusion generated WSDL

我正在处理 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"/>

使用 hint 属性不会添加注释和文档子元素,但我无法在 ColdFusion 文档中找到实现此目的的另一种方法。

在寻找答案时,我看到 ColdFusion SOAP Web 服务被描述为 "half-baked"。我是不是因为尝试这个而让自己失败了?

如果您想控制 ColdFusion 生成的 WSDL,您可以使用 cfcomponent 标签的 wsdlfile 属性来使用预定义的 WSDL 文件,而不是使用生成的 WSDL 文件来自 ColdFusion。

来自 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.

很可能您需要稍微尝试一下才能获得您想要的输出。我不久前将这个答案发布到另一个类似的问题 - 请注意那里发布的关于端点 URL 需要在 WSDL 中的评论。