【问题标题】:WSDL binding - soapAction valueWSDL 绑定——soapAction 值
【发布时间】:2015-02-12 02:58:08
【问题描述】:

在以下 WSDL 的摘录中,在行

<soap1:operation style="document" soapAction="petition"

指定有什么区别

  • soapAction="请愿书"

  • soapAction="/Services/ReincarnationPermitService.serviceagent/ReincarnationRequestPortTypeEndpoint/petition"

<wsdl:service name="ReincarnationPermitService">
    <wsdl:port name="ReincarnationRequestPortTypeEndpoint" binding="tns:ReincarnationRequestPortTypeEndpointBinding">
        <soap1:address location="http://sheol:666/Services/ReincarnationPermitService.serviceagent/ReincarnationRequestPortTypeEndpoint"/>
    </wsdl:port>
</wsdl:service>
<wsdl:portType name="ReincarnationRequestPortType">
    <wsdl:operation name="acceptRequest">
        <wsdl:input message="tns:ReincarnationParticulars"/>
        <wsdl:output message="tns:PetitionResponse"/>
        <wsdl:fault name="denied" message="tns:Rejection"/>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ReincarnationRequestPortTypeEndpointBinding" type="tns:ReincarnationRequestPortType">
    <soap1:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="acceptRequest">
        <soap1:operation style="document" soapAction="petition" soapActionRequired="true"/>
        <wsdl:input>
            <soap1:body use="literal" parts="ReincarnationParticulars"/>
        </wsdl:input>
        <wsdl:output>
            <soap1:body use="literal" parts="Approved"/>
        </wsdl:output>
        <wsdl:fault name="denied">
            <soap1:fault use="literal" name="denied"/>
        </wsdl:fault>
    </wsdl:operation>
</wsdl:binding>

【问题讨论】:

    标签: soap wsdl endpoint


    【解决方案1】:

    这就是我发现的……所以回答我自己的问题。

    soapAction 属性是服务提供者意图的指示,这很可能是由服务框架构建的。

    soapAction 帮助服务提供者将soap 操作映射到意图解析器。无论出于何种意图和目的,它都是被调用来为操作提供服务的例程。

    soapAction 属性是服务提供者框架唯一标识调用哪个入口点或例程来为操作提供服务的一种方式。

    因此,soapAction 属性可以是任何值,其模式可能由框架决定。在我正在使用的框架中,soapAction 的值是什么与框架无关,soapAction 属性值只是对处理调用的入口点的引用。

    【讨论】:

      【解决方案2】:

      soap1:operation 元素的soapAction="petition" 属性将包含在 HTTP 请求消息中,如下所示:

      POST /StockQuote HTTP/1.1
      Content-Type: text/xml; charset="utf-8"
      Content-Length: nnnn
      SOAPAction: "petition"
      

      SOAPAction HTTP 请求标头字段可用于指示 SOAP HTTP 请求的意图。该值是标识意图的 URI。 SOAP 对 URI 的格式或特性或可解析没有任何限制。 HTTP 客户端在发出 SOAP HTTP 请求时必须使用此标头字段。

      SOAPAction 标头字段的存在和内容可以被防火墙等服务器用来适当地过滤 HTTP 中的 SOAP 请求消息。空字符串 ("") 的头字段值表示 SOAP 消息的意图由 HTTP Request-URI 提供。没有值意味着没有指示消息的意图。

      例子:

      SOAPAction: "/Services/ReincarnationRequestPortTypeEndpoint/petition"
      SOAPAction: "petition"
      SOAPAction: ""
      SOAPAction:
      

      【讨论】:

        【解决方案3】:

        当消费者将soapAction属性用于特定目的时,我们也遇到过类似的情况,当我们更新WSDL(主要是soapAction字段)时,它破坏了消费者代码。

        基本上从soap 1.1 开始,soapAction 就不再使用了,除了它只用于文档,它可以是空的。

        正如另一个答案中提到的,它可以描述操作的意图,但又是出于文档目的。

        我们使用它的方式如下;

        <soap:operation soapAction="http://company.com.au/hub/services/NotificationApplication/GenerateDocumentNotification?applicationVersion=NotificationApplication_v1.8.9"/>
        

        附: soapAction 在soap 1.2 中被完全移除了,所以最好不要太依赖这个!

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-26
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-03-15
          • 1970-01-01
          相关资源
          最近更新 更多