第五十八章 生成的 WSDL 的详细信息 - 由方法签名变化引起的WSDL变化

41 阅读1分钟

第五十八章 生成的 WSDL 的详细信息 - 由方法签名变化引起的WSDL变化

由方法签名变化引起的WSDL变化

本节展示了由方法签名中的变化引起的一些WSDL变化。

通过引用或作为输出参数返回值

要通过引用或作为输出参数返回值,请在web方法的签名中酌情使用ByRefoutput关键字。此更改影响模式和SOAP响应消息。

例如,考虑以下web方法签名,来自两个不同web服务中的方法:

//from web service 1
Method HelloWorld() As %String [ WebMethod ]

//from web service 2
Method HelloWorld(ByRef myarg As %String) [ WebMethod ]

对于第一个web服务,<types>部分如下所示:

<types>
    <s:schema elementFormDefault="qualified" targetNamespace="https://www.helloworld.org">
        <s:element name="HelloWorld1">
            <s:complexType>
                <s:sequence/>
            </s:complexType>
        </s:element>
        <s:element name="HelloWorld1Response">
            <s:complexType>
                <s:sequence>
                    <s:element name="HelloWorld1Result" type="s:string"/>
                </s:sequence>
            </s:complexType>
        </s:element>
    </s:schema>
</types>

对于第二个web服务,它通过引用返回值,<types>部分有一个对应于响应消息的类型的变体:

<types>
...
        <s:element name="HelloWorld2Response">
            <s:complexType>
                <s:sequence>
                    <s:element minOccurs="0" name="myarg" type="s:string"/>
...

这表明<HelloWorld2Response>消息中包含的元素是<myarg>,它对应于消息签名中参数的名称。相反,这个元素通常是<methodnameResult>

如果使用ByRef关键字而不是Output,则对WSDL具有相同的效果。