欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

WSDL Message Exchange Patterns(转)

程序员文章站 2022-05-30 16:05:24
...
this section describes message exchange patterns defined in WSDL Version 2.0 Part 2: Adjuncts - In-Only, Robust In-Only, and In-Out.

What Is a WSDL Message Exchange Pattern? A WSDL message exchange pattern is a predefined sequence of in/out message of an operation in an abstract interface. Each pattern is represented by a unique URI, which can be specified as the "pattern" attribute of an operation.

WSDL 2.0 specification (WSDL Version 2.0 Part 2: Adjuncts) provides 3 predefined patterns: In-Only, Robust In-Only, and In-Out.

1. In-Only, represented by URI: http://www.w3.org/ns/wsdl/in-only - In-Only pattern defines only 1 single message that goes into the service provider of this operation. This message label is "In" and direction is "in". In-Only pattern does not allow any fault messages. Here is an example operation that uses the In-Only pattern:

    <wsdl:operation name="SnowDay"
      pattern="http://www.w3.org/ns/wsdl/in-only"
      style="http://www.w3.org/ns/wsdl/style/iri">
      <wsdl:input messageLabel="In"
        element="hy:SnowDayAnnouncement"/>
    </wsdl:operation>

2. Robust In-Only, represented by URI: http://www.w3.org/ns/wsdl/robust-in-only - Robust In-Only pattern defines only 1 single message that goes into the service provider of this operation. This message label is "In" and direction is "in". Robust In-Only pattern needs a fault message in the "out" direction. The fault message will be triggered by the input message, if needed. Here is an example operation that uses the Robust In-Only pattern:

  <wsdl:interface name="AlertInterface" >
    <wsdl:fault name="invalidEmailFault" element="InvalidEmail"/>
    <wsdl:operation name="SendAlert"
      pattern="http://www.w3.org/ns/wsdl/robust-in-only"
      style="http://www.w3.org/ns/wsdl/style/iri">
      <wsdl:input messageLabel="In"
        element="hy:AlertEmail"/>
      <wsdl:outfault ref="invalidEmailFault" messageLabel="Out"/>
    </wsdl:operation>
  </wsdl:interface>

3. In-Out, represented by URI: http://www.w3.org/ns/wsdl/in-out - In-Out pattern defines 2 messages: an input message followed by an output message. The input message is labeled as "In" and has a direction of "in". The output message is labeled as "Out" and has a direction of "out". In-Out pattern needs a fault message in the "out" direction. The service provider may replace the output message by the fault message, if needed. Here is an example operation that uses the In-Out pattern:

  <wsdl:interface name="GetQuoteInterface" >
    <wsdl:fault name="marketClosedFault" element="MarketClosed"/>
    <wsdl:operation name="GetQuote"
      pattern="http://www.w3.org/ns/wsdl/in-out"
      style="http://www.w3.org/ns/wsdl/style/iri">
      <wsdl:input messageLabel="In"
        element="hy:GetQuoteRequest"/>
      <wsdl:output messageLabel="Out"
        element="hy:GetQuoteResponse"/>
      <wsdl:outfault ref="marketClosedFault" messageLabel="Out"/>
    </wsdl:operation>
  </wsdl:interface>

Some Web sites include other message exchange patterns like In-Optional-Out, Out-Only, Robust Out-Only, Out-In, Out-Optional-In, etc. as part of the WSDL 2.0. But I can not find them in the WSDL 2.0 2007 specification.

2007年推出wsdl2.0