Section 16.4. Messages and Protocols


16.4. Messages and Protocols

This section concentrates on the messages exchanged as part of the atomic transaction executed by the aggregator service implementation when a customer invokes the purchase operation. This section does not discuss how the security protocols that are used in the interaction with the end user are supported by SOAP headers. Instead, refer to Chapter 15, "Case Study: Car Parts Supply Chain," where a similar usage of WS-Security is discussed in detail.

As explained previously, the implementation of the purchase operation invokes the "account charge" and the "update customer profile" operations atomically. The aggregation service initiates a new transaction, which results in a series of protocol messages exchanged between the transaction coordinators, in addition to the expected business message exchanges that the WSDL port types describe. Some of the messages received at the account service during this exchange are shown next. The initial invocation of the charge account operation contains a coordination context identifying the transaction and the registration service to use.

 <S:Envelope>   <S:Header>      <wsa:To>http://www.purchase.com/account-svc</wsa:To>      <wsa:Action> http://www.purchase.com/services/AccountPortType/ChargeAccount       </wsa:Action>       <wsa:ReplyTo>                 <wsa:Address>    http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous          </wsa:Address>       </wsa:ReplyTo>       <wsa:MessageID>uid:19884704:ff4a653d59:-7fba</wsa:MessageID>       <wsc:CoordinationContext>          <util:Identifier>             http://www.purchase.com/purchase/0000000000000000FF4A64A2CA0902122F00          </util:Identifier>                  <wsc:CoordinationType>          http://schemas.xmlsoap.org/ws/2003/09/wsat          </wsc:CoordinationType>          <wsc:RegistrationService>            <wsa:Address> http://www.purchase.com/purchase/registrationCoordinator            </wsa:Address>            <wsa:ReferenceProperties>               <pch-tx:TransactionId> http://www.purchase.com/purchase/0000000000000000FF4A64A2CA0902122F00               </pch-tx:TransactionId>            </wsa:ReferenceProperties>          </wsc:RegistrationService>       </wsc:CoordinationContext>    </S:Header>    <S:Body>      <ChargeAccountRequest>         <account>AX2345</account>         <amount>800.0</amount>      </ChargeAccountRequest>    </S:Body> </S:Envelope> 

The coordination context header triggers the registration of the coordinator at the account service with the registration service passed inside the coordination context. The registration service responds with a RegisterResponse protocol message, as follows:

 <S:Envelope>    <S:Header>       <wsa:RelatesTo RelationshipType="n1:Reply">          uid:6c154704:ff4a65a8bb:-8000       </wsa:RelatesTo>           <wsa:To> http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous       </wsa:To> <wsa:Action>urn:WSCoordination/registrationResponse</wsa:Action>    </S:Header>    <S:Body>      <wsc:RegisterResponse>         <wsc:CoordinatorProtocolService>            <wsa:Address xsi:type="xsd:anyURI">            http://www.purchase.com/purchase/coordinator            </wsa:Address>            <wsa:ReferenceProperties>               <pch-tx:TransactionId> http://www.purchase.com/purchase/0000000000000000FF4A64A2CA0902122F00               </pch:TransactionId>               <pch-tx:ParticipantId>1</pch:ParticipantId>            </wsa:ReferenceProperties>         </wsc:CoordinatorProtocolService>      </wsc:RegisterResponse>   </S:Body> </S:Envelope> 

If both the account charge and the update profile operations are able to successfully complete their execution, they will return with appropriate application messages to the invoking service, and the coordinator of the transaction will drive it to completion with another set of protocol messages, terminating in a commit message sent to the two participating services. The final example shows a SOAP envelope containing the commit message sent to the account service.

 <S:Envelope>   <S:Header>      <wsa:MessageID>uid:19884704:ff4a653d59:-7fb6</wsa:MessageID> <wsa:To>http://www.purchase.com/purchase/participant</wsa:To>      <wsa:Action>        http://schemas.xmlsoap.org/ws/2003/09/wsat#Commit      </wsa:Action>      <pch-tx:TransactionId> http://www.purchase.com/0000000000000000FF4A64A2CA0902122F00      </pch-tx:TransactionId>        <pch-tx:ProtocolId>         http://schemas.xmlsoap.org/ws/2003/09/wsat#Durable2PC      </pch-tx:ProtocolId>   </S:Header>   <S:Body>      <wsat:Commit/>   </S:Body> </S:Envelope> 



    Web Services Platform Architecture(c) SOAP, WSDL, WS-Policy, WS-Addressing, WS-BP[.  .. ] More
    Web Services Platform Architecture(c) SOAP, WSDL, WS-Policy, WS-Addressing, WS-BP[. .. ] More
    ISBN: N/A
    EAN: N/A
    Year: 2005
    Pages: 176

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net