HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

Introducing WS-Transaction Part 1 by Dr. Jim Webber & Dr. Mark Little
WSJ Vol 03 Issue 06 - pg.28



Listing 1: WS-Transaction Context

<!-- Create atomic transaction context message -->
<CreateCoordinationContext>
  <ActivationService>
   <wsu:Address>
   http://example.org/ws-transaction/activation
   </wsu:Address>
  </ActivationService>
  <RequesterReference>
   <wsu:Address>
   http://example.org/ws-transaction/client-app
   </wsu:Address>
  </RequesterReference>
  <CoordinationType>
  http://schemas.xmlsoap.org/ws/2002/08/wstx
  </CoordinationType>
</CreateCoordinationContext>

<!-- Atomic transaction context -->
<wscoor:CoordinationContext 
 xmlns:wscoor="http://schemas.xmlsoap.org/ws/2002/08/wscoor" 
 xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
  <wsu:Identifier>
  http://example.org/tx-id/aabb-1122-ddee-3344-ff00
  </wsu:Identifier>
  <wsu:Expires>2003-06-30T00:00:00-08:00</wsu:Expires>
  <wscoor:CoordinationType>
  http://schemas.xmlsoap.org/ws/2002/08/wstx
  </wscoor:CoordinationType>
  <wscoor:RegistrationService>
   <wsu:Address>
   http://example.org/ws-transaction/registration
   </wsu:Address>
  </wscoor:RegistrationService>
</wscoor:CoordinationContext>

Listing 2:  PhaseZero Coordinator and Participant Interfaces

<!-- PhaseZero Participant Interface -->
<wsdl:portType name="PhaseZeroParticipantPortType">
  <wsdl:operation name="PhaseZero">
   <wsdl:input message="wstx:PhaseZero" />
  </wsdl:operation>
  <wsdl:operation name="Error">
   <wsdl:input message="wstx:Error" />
  </wsdl:operation>
</wsdl:portType>

<!-- PhaseZero Coordinator Interface -->
<wsdl:portType name="PhaseZeroCoordinatorPortType">
  <wsdl:operation name="PhaseZeroCompleted">
   <wsdl:input message="wstx:PhaseZeroCompleted" />
  </wsdl:operation>
  <wsdl:operation name="Unknown">
   <wsdl:input message="wstx:Unknown" />
  </wsdl:operation>
  <wsdl:operation name="Error">
   <wsdl:input message="wstx:Error" />
  </wsdl:operation>
</wsdl:portType>

Listing 3:  2PC Protocol Coordinator and Participant WSDL Interfaces

<!-- 2PC Coordinator Interface -->
<wsdl:portType name="2PCCoordinatorPortType">
  <wsdl:operation name="Prepared">
   <wsdl:input message="wstx:Prepared" />
  </wsdl:operation>
  <wsdl:operation name="Aborted">
   <wsdl:input message="wstx:Aborted"/>
  </wsdl:operation>
  <wsdl:operation name="ReadOnly">
   <wsdl:input message="wstx:ReadOnly"/>
  </wsdl:operation>
  <wsdl:operation name="Committed">
   <wsdl:input message="wstx:Committed"/>
  </wsdl:operation>
  <wsdl:operation name="Replay">
   <wsdl:input message="wstx:Replay"/>
  </wsdl:operation>
  <wsdl:operation name="Unknown">
   <wsdl:input message="wstx:Unknown" />
  </wsdl:operation>
  <wsdl:operation name="Error">
   <wsdl:input message="wstx:Error"/>
  </wsdl:operation>
</wsdl:portType>

<!-- 2PC Participant Interface -->
<wsdl:portType name="2PCParticipantPortType">
  <wsdl:operation name="Prepare">
   <wsdl:input message="wstx:Prepare"/>
  </wsdl:operation>
  <wsdl:operation name="OnePhaseCommit">
   <wsdl:input message="wstx:OnePhaseCommit"/>
  </wsdl:operation>
  <wsdl:operation name="Commit">
   <wsdl:input message="wstx:Commit"/>
  </wsdl:operation>
  <wsdl:operation name="Rollback">
   <wsdl:input message="wstx:Rollback"/>
  </wsdl:operation>
  <wsdl:operation name="Unknown">
   <wsdl:input message="wstx:Unknown"/>
  </wsdl:operation>
  <wsdl:operation name="Error">
   <wsdl:input message="wstx:Error"/>
  </wsdl:operation>
</wsdl:portType>