[jboss-svn-commits] JBL Code SVN: r34953 - in labs/jbosstm/trunk/XTS: WS-C/dev/src11/com/arjuna/wsc11 and 31 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 1 10:09:53 EDT 2010


Author: adinn
Date: 2010-09-01 10:09:52 -0400 (Wed, 01 Sep 2010)
New Revision: 34953

Added:
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t-rpc_handlers.xml
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/envelope.xsd
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat-completion-coordinator-rpc-binding.wsdl
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorRPCClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorRPCProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/server/TerminationCoordinatorRPCInitialisation.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorRPCClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/processors/CompletionCoordinatorRPCProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionCoordinatorRPCPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/server/CompletionCoordinatorRPCInitialisation.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CompletionCoordinatorRPCProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorRPCProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorRPCStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionRPCStub.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCPortType.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCService.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/participants/CompletionCoordinatorRPCImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionStandaloneImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityStandaloneImple.java
Modified:
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/ActivationCoordinator.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/RegistrationCoordinator.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/ActivationCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/RegistrationCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/build.xml
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t11-coordinator_web-app.xml
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/build.sh
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx.wsdl
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/build.sh
   labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat.wsdl
   labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/ArjunaTXConstants.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationParticipantPortType.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/ArjunaTX11Constants.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/WSARJTXClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationParticipantPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/AtomicTransactionConstants.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/WSATClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/deploy/WSTCoordinatorInitialisation.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/RegistrarImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/TransactionManagerImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/ContextFactoryImple.java
   labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/RegistrarImple.java
   labs/jbosstm/trunk/XTS/config/xts-properties.xml
   labs/jbosstm/trunk/XTS/config/xts-properties11.xml
   labs/jbosstm/trunk/XTS/sar/META-INF/xts-jboss-beans.xml
   labs/jbosstm/trunk/XTS/sar/META-INF/xts11-jboss-beans.xml
   labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/initialisation/CoordinatorSideInitialisation.java
Log:
modified client to allow RPC based exchange for client transaction termination -- fixes for JBTM-776

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -2,11 +2,16 @@
 
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.util.InvalidEnumerationException;
 import org.w3c.dom.Element;
 import org.xmlsoap.schemas.soap.envelope.Fault;
 import org.xmlsoap.schemas.soap.envelope.ObjectFactory;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.soap.SOAPFaultException;
 
 /**
  * Created by IntelliJ IDEA.
@@ -157,6 +162,20 @@
         }
     }
 
+    public static SoapFault11 create(SOAPFaultException sfe)
+    {
+        try {
+            SOAPFault cause = sfe.getFault();
+            QName faultCode = cause.getFaultCodeAsQName();
+            String reason = cause.getFaultString();
+            SoapFaultType soapFaultType = SoapFaultType.toState(reason);
+            Detail detail = cause.getDetail();
+            return new SoapFault11(soapFaultType, faultCode, null, detail);
+        } catch (InvalidEnumerationException e) {
+            return new SoapFault11(e);
+        }
+
+    }
      /**
       * Get the SOAP fault detailElement.
       * @return The SOAP fault detailElement.

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/ActivationCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/ActivationCoordinator.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/ActivationCoordinator.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -33,6 +33,7 @@
 import org.oasis_open.docs.ws_tx.wscoor._2006._06.Expires;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.soap.SOAPFaultException;
 import java.io.IOException;
@@ -85,9 +86,11 @@
             final QName subcode = soapFault.getFaultCodeAsQName() ;
             if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME.equals(subcode))
             {
-                throw new InvalidCreateParametersException(soapFault.getFaultString());
+                Detail detail = soapFault.getDetail();
+                String message = (detail != null ? detail.getTextContent() : soapFault.getFaultString());
+                throw new InvalidCreateParametersException(message);
             }
-            throw new SoapFault11(sfe);
+            throw SoapFault11.create(sfe);
         }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/RegistrationCoordinator.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/RegistrationCoordinator.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/RegistrationCoordinator.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -11,6 +11,7 @@
 import org.oasis_open.docs.ws_tx.wscoor._2006._06.RegistrationPortType;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.soap.SOAPFaultException;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -53,22 +54,27 @@
             response = port.registerOperation(registerType);
             return response.getCoordinatorProtocolService();
         } catch (SOAPFaultException sfe) {
-            // TODO -- work out which faults we should really throw. in particular do we need to retain SoapFault
             final SOAPFault soapFault = sfe.getFault() ;
             final QName subcode = soapFault.getFaultCodeAsQName() ;
             if (CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME.equals(subcode))
             {
-                throw new CannotRegisterException(soapFault.getFaultString()) ;
+                Detail detail = soapFault.getDetail();
+                String message = (detail != null ? detail.getTextContent() : soapFault.getFaultString());
+                throw new CannotRegisterException(message) ;
             }
             else if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PROTOCOL_QNAME.equals(subcode))
             {
-                throw new InvalidProtocolException(soapFault.getFaultString()) ;
+                Detail detail = soapFault.getDetail();
+                String message = (detail != null ? detail.getTextContent() : soapFault.getFaultString());
+                throw new InvalidProtocolException(message) ;
             }
             else if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME.equals(subcode))
             {
-                throw new InvalidStateException(soapFault.getFaultString()) ;
+                Detail detail = soapFault.getDetail();
+                String message = (detail != null ? detail.getTextContent() : soapFault.getFaultString());
+                throw new InvalidStateException(message) ;
             }
-            throw new SoapFault11(sfe);
+            throw SoapFault11.create(sfe);
         }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/ActivationCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/ActivationCoordinatorProcessorImpl.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/ActivationCoordinatorProcessorImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -29,6 +29,7 @@
 import com.arjuna.wsc.InvalidCreateParametersException;
 import com.arjuna.wsc11.ContextFactoryMapper;
 
+import javax.xml.soap.SOAPException;
 import javax.xml.ws.soap.SOAPFaultException;
 import javax.xml.ws.ProtocolException;
 import javax.xml.soap.SOAPFault;
@@ -103,11 +104,10 @@
                 throw new SOAPFaultException(soapFault);
             }
         }
-        catch (Throwable throwable)
+        catch (SOAPException se)
         {
-            throwable.printStackTrace(System.err);
-            throw new ProtocolException(throwable);
-
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
         }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/RegistrationCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/RegistrationCoordinatorProcessorImpl.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/wsc11/messaging/RegistrationCoordinatorProcessorImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -33,6 +33,7 @@
 import org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterResponseType;
 import org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterType;
 
+import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.ProtocolException;
@@ -126,10 +127,10 @@
                 throw new SOAPFaultException(soapFault);
             }
         }
-        catch (Throwable throwable)
+        catch (SOAPException se)
         {
-            throwable.printStackTrace(System.err);
-            throw new ProtocolException(throwable);
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
         }
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/build.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/build.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -249,6 +249,7 @@
         <copy file="${dd.dir}/wscoor1.1/wsdl/wsat-coordinator-binding.wsdl" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsat/_2006/_06/wsdl/wsat-coordinator-binding.wsdl"/>
         <copy file="${dd.dir}/wscoor1.1/wsdl/wsat-completion-initiator-binding.wsdl" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsat/_2006/_06/wsdl/wsat-completion-initiator-binding.wsdl"/>
         <copy file="${dd.dir}/wscoor1.1/wsdl/wsat-completion-coordinator-binding.wsdl" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsat/_2006/_06/wsdl/wsat-completion-coordinator-binding.wsdl"/>
+        <copy file="${dd.dir}/wscoor1.1/wsdl/wsat-completion-coordinator-rpc-binding.wsdl" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsat/_2006/_06/wsdl/wsat-completion-coordinator-rpc-binding.wsdl"/>
 
         <copy file="${dd.dir}/wscoor1.1/wsdl/wsba.wsdl" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsba/_2006/_06/wsdl/wsba.wsdl"/>
         <copy file="${dd.dir}/wscoor1.1/wsdl/wsba.xsd" tofile="${build.classes11.dir}/org/oasis_open/docs/ws_tx/wsba/_2006/_06/wsdl/wsba.xsd"/>
@@ -285,6 +286,7 @@
 
     <target name="jars11">
         <copy file="${dd.dir}/ws-t_handlers.xml" tofile="${build.classes11.dir}/ws-t_handlers.xml"/>
+        <copy file="${dd.dir}/ws-t-rpc_handlers.xml" tofile="${build.classes11.dir}/ws-t-rpc_handlers.xml"/>
         <jar jarfile="${build.lib.dir}/ws-t11.jar">
             <fileset dir="${build.classes11.dir}" excludes="${ws-t11.api.classes}"/>
         </jar>

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t-rpc_handlers.xml (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t_handlers.xml)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t-rpc_handlers.xml	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t-rpc_handlers.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  JBoss, Home of Professional Open Source
+  Copyright 2007, Red Hat Middleware LLC, and individual contributors
+  as indicated by the @author tags. 
+  See the copyright.txt in the distribution for a full listing 
+  of individual contributors.
+  This copyrighted material is made available to anyone wishing to use,
+  modify, copy, or redistribute it subject to the terms and conditions
+  of the GNU Lesser General Public License, v. 2.1.
+  This program is distributed in the hope that it will be useful, but WITHOUT A
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+  PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+  You should have received a copy of the GNU Lesser General Public License,
+  v.2.1 along with this distribution; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+  MA  02110-1301, USA.
+
+  
+  (C) 2007,
+  @author JBoss Inc.
+-->
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee" 
+xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee">
+    <handler-chain>
+	<handler>
+		<handler-name>Instance Identifier Handler</handler-name>
+		<handler-class>com.arjuna.webservices11.wsarj.handler.InstanceIdentifierInHandler</handler-class>
+	</handler>
+        <!-- should not need this any more
+	<handler>
+		<handler-name>WS Addressing Server Handler</handler-name>
+		<handler-class>org.jboss.ws.extensions.addressing.jaxws.WSAddressingServerHandler</handler-class>
+	</handler>
+	-->
+    </handler-chain>
+</handler-chains>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t11-coordinator_web-app.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t11-coordinator_web-app.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/ws-t11-coordinator_web-app.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -41,6 +41,12 @@
     </servlet>
 
     <servlet>
+      <servlet-name>CompletionCoordinatorRPC</servlet-name>
+      <servlet-class>com.arjuna.webservices11.wsat.sei.CompletionCoordinatorRPCPortTypeImpl</servlet-class>
+      <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet>
       <servlet-name>BusinessAgreementWithCoordinatorCompletionCoordinator</servlet-name>
       <servlet-class>com.arjuna.webservices11.wsba.sei.BusinessAgreementWithCoordinatorCompletionCoordinatorPortTypeImpl</servlet-class>
       <load-on-startup>1</load-on-startup>
@@ -58,6 +64,12 @@
       <load-on-startup>1</load-on-startup>
     </servlet>
 
+    <servlet>
+      <servlet-name>TerminationCoordinatorRPC</servlet-name>
+      <servlet-class>com.arjuna.webservices11.wsarjtx.sei.TerminationCoordinatorRPCPortTypeImpl</servlet-class>
+      <load-on-startup>1</load-on-startup>
+    </servlet>
+
     <!-- Coordinator Side Endpoint Mappings -->
     <servlet-mapping>
       <servlet-name>Coordinator</servlet-name>
@@ -67,6 +79,10 @@
       <servlet-name>CompletionCoordinator</servlet-name>
       <url-pattern>/CompletionCoordinatorService</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+      <servlet-name>CompletionCoordinatorRPC</servlet-name>
+      <url-pattern>/CompletionCoordinatorRPCService</url-pattern>
+    </servlet-mapping>
 
     <!-- Define WSBA 1.1 JaxWS Server Endpoint Mappings -->
     <servlet-mapping>
@@ -83,4 +99,9 @@
       <servlet-name>TerminationCoordinator</servlet-name>
       <url-pattern>/TerminationCoordinatorService</url-pattern>
     </servlet-mapping>
+
+    <servlet-mapping>
+      <servlet-name>TerminationCoordinatorRPC</servlet-name>
+      <url-pattern>/TerminationCoordinatorRPCService</url-pattern>
+    </servlet-mapping>
 </web-app>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/build.sh
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/build.sh	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/build.sh	2010-09-01 14:09:52 UTC (rev 34953)
@@ -24,10 +24,16 @@
 
 # generate termination participant and coordinator code
 
-$GF_HOME/bin/wsimport -verbose -keep -wsdllocation wsdl/wsarjtx-termination-participant-binding.wsdl -d tmp/classes -s tmp/src -target 2.1 wsdl/wsarjtx-termination-participant-binding.wsdl
+# $GF_HOME/bin/wsimport -verbose -keep -wsdllocation wsdl/wsarjtx-termination-participant-binding.wsdl -d tmp/classes -s tmp/src -target 2.1 wsdl/wsarjtx-termination-participant-binding.wsdl
 
-$GF_HOME/bin/wsimport -verbose -keep -wsdllocation wsdl/wsarjtx-termination-coordinator-binding.wsdl -d tmp/classes -s tmp/src -target 2.1 wsdl/wsarjtx-termination-coordinator-binding.wsdl
+# $GF_HOME/bin/wsimport -verbose -keep -wsdllocation wsdl/wsarjtx-termination-coordinator-binding.wsdl -d tmp/classes -s tmp/src -target 2.1 wsdl/wsarjtx-termination-coordinator-binding.wsdl
 
+$JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsarjtx-termination-coordinator-binding.wsdl -o tmp/classes -s tmp/src -k wsdl/wsarjtx-termination-coordinator-binding.wsdl
+
+$JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsarjtx-termination-participant-binding.wsdl -o tmp/classes -s tmp/src -k wsdl/wsarjtx-termination-participant-binding.wsdl
+
+$JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl -o tmp/classes -s tmp/src -k wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl
+
 # we need to patch the resource lookup used to provide a jar base URL
 # for the wsdl location supplied above wsimport generates
 # e.g. 'qualified.path.ClassName.class.getResource(".")' to locate a
@@ -38,3 +44,4 @@
 
 sed -i -e 's/TerminationCoordinatorService.class.getResource(".")/TerminationCoordinatorService.class.getResource("")/' tmp/src/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationCoordinatorService.java
 sed -i -e 's/TerminationParticipantService.class.getResource(".")/TerminationParticipantService.class.getResource("")/' tmp/src/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationParticipantService.java
+sed -i -e 's/TerminationCoordinatorRPCService.class.getResource(".")/TerminationCoordinatorRPCService.class.getResource("")/' tmp/src/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationCoordinatorRPCService.java

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/envelope.xsd (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/envelope.xsd)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/envelope.xsd	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/envelope.xsd	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!-- Schema for the SOAP/1.1 envelope
+
+Portions © 2001 DevelopMentor. 
+© 2001 W3C (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.  
+ 
+This document is governed by the W3C Software License [1] as described in the FAQ [2].
+[1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
+[2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD 
+By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
+
+Permission to use, copy, modify, and distribute this software and its documentation, with or without modification,  for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
+
+1.  The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 
+
+2.  Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" 
+
+3.  Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.)   
+
+Original W3C files; http://www.w3.org/2001/06/soap-envelope
+Changes made: 
+     - reverted namespace to http://schemas.xmlsoap.org/soap/envelope/
+     - reverted mustUnderstand to only allow 0 and 1 as lexical values
+	 - made encodingStyle a global attribute 20020825
+	 - removed default value from mustUnderstand attribute declaration
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+
+The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"
+           targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" >
+
+     
+  <!-- Envelope, header and body -->
+  <xs:element name="Envelope" type="tns:Envelope" />
+  <xs:complexType name="Envelope" >
+    <xs:sequence>
+      <xs:element ref="tns:Header" minOccurs="0" />
+      <xs:element ref="tns:Body" minOccurs="1" />
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax" />
+  </xs:complexType>
+
+  <xs:element name="Header" type="tns:Header" />
+  <xs:complexType name="Header" >
+    <xs:sequence>
+      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax" />
+  </xs:complexType>
+  
+  <xs:element name="Body" type="tns:Body" />
+  <xs:complexType name="Body" >
+    <xs:sequence>
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##any" processContents="lax" >
+	  <xs:annotation>
+	    <xs:documentation>
+		  Prose in the spec does not specify that attributes are allowed on the Body element
+		</xs:documentation>
+	  </xs:annotation>
+	</xs:anyAttribute>
+  </xs:complexType>
+
+       
+  <!-- Global Attributes.  The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.  -->
+  <xs:attribute name="mustUnderstand" >	
+     <xs:simpleType>
+     <xs:restriction base='xs:boolean'>
+	   <xs:pattern value='0|1' />
+	 </xs:restriction>
+   </xs:simpleType>
+  </xs:attribute>
+  <xs:attribute name="actor" type="xs:anyURI" />
+
+  <xs:simpleType name="encodingStyle" >
+    <xs:annotation>
+	  <xs:documentation>
+	    'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
+	  </xs:documentation>
+	</xs:annotation>
+    <xs:list itemType="xs:anyURI" />
+  </xs:simpleType>
+
+  <xs:attribute name="encodingStyle" type="tns:encodingStyle" />
+  <xs:attributeGroup name="encodingStyle" >
+    <xs:attribute ref="tns:encodingStyle" />
+  </xs:attributeGroup>
+
+  <xs:element name="Fault" type="tns:Fault" />
+  <xs:complexType name="Fault" final="extension" >
+    <xs:annotation>
+	  <xs:documentation>
+	    Fault reporting structure
+	  </xs:documentation>
+	</xs:annotation>
+    <xs:sequence>
+      <xs:element name="faultcode" type="xs:QName" />
+      <xs:element name="faultstring" type="xs:string" />
+      <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
+      <xs:element name="detail" type="tns:detail" minOccurs="0" />      
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="detail">
+    <xs:sequence>
+      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+    <xs:anyAttribute namespace="##any" processContents="lax" /> 
+  </xs:complexType>
+
+</xs:schema>
+
+
+
+
+
+

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx-termination-coordinator-binding.wsdl)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx-termination-coordinator-rpc-binding.wsdl	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2007 JBoss -->
+<wsdl:definitions name="WSARJTX-COORDINATOR-RPC-BINDING"
+		  targetNamespace="http://schemas.arjuna.com/ws/2005/10/wsarjtx"
+		  xmlns="http://schemas.xmlsoap.org/wsdl/" 
+		  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+		  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+		  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+		  xmlns:wsarjtx="http://schemas.arjuna.com/ws/2005/10/wsarjtx">
+    <wsdl:import
+        namespace="http://schemas.arjuna.com/ws/2005/10/wsarjtx"
+        location="wsarjtx.wsdl" />
+
+	<!-- SOAP bindings for termination coordinator port -->
+	<wsdl:binding name="TerminationCoordinatorRPC_SOAPBinding" type="wsarjtx:TerminationCoordinatorRPCPortType">
+	        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+		<wsdl:operation name="CompleteOperation">
+		    <soap:operation soapAction="http://schemas.arjuna.com/ws/2005/10/wsarjtx/Complete" style="document"/>
+            <wsdl:input name="Complete">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="Completed">
+                <soap:body use="literal"/>
+            </wsdl:output>
+		</wsdl:operation>
+
+		<wsdl:operation name="CloseOperation">
+		    <soap:operation soapAction="http://schemas.arjuna.com/ws/2005/10/wsarjtx/Close" style="document"/>
+			<wsdl:input name="Close">
+		            <soap:body use="literal"/>
+			</wsdl:input>
+            <wsdl:output name="Closed">
+                <soap:body use="literal"/>
+            </wsdl:output>
+		</wsdl:operation>
+		<wsdl:operation name="CancelOperation">
+		    <soap:operation soapAction="http://schemas.arjuna.com/ws/2005/10/wsarjtx/Cancel" style="document"/>
+			<wsdl:input name="Cancel">
+		            <soap:body use="literal"/>
+			</wsdl:input>
+            <wsdl:output name="Cancelled">
+                <soap:body use="literal"/>
+            </wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<!-- termination coordinator service definition -->
+	<wsdl:service name="TerminationCoordinatorRPCService">
+	    <wsdl:port binding="wsarjtx:TerminationCoordinatorRPC_SOAPBinding" name="TerminationCoordinatorRPCPortType">
+                <soap:address location="http://localhost:9000/wst11/TerminationCoordinatorRPCService"/>
+	    </wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx.wsdl
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx.wsdl	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wsarjtx/wsdl/wsarjtx.wsdl	2010-09-01 14:09:52 UTC (rev 34953)
@@ -5,10 +5,15 @@
 		  xmlns="http://schemas.xmlsoap.org/wsdl/" 
 		  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 		  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+          xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 		  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 		  xmlns:wsarjtx="http://schemas.arjuna.com/ws/2005/10/wsarjtx">
         <wsdl:types>
-	  <schema targetNamespace="http://schemas.arjuna.com/ws/2005/10/wsarjtx" 
+            <xsd:schema>
+                <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/"
+                          schemaLocation="envelope.xsd"/>
+            </xsd:schema>
+	  <schema targetNamespace="http://schemas.arjuna.com/ws/2005/10/wsarjtx"
 		  xmlns="http://www.w3.org/2001/XMLSchema"
 		  elementFormDefault="qualified">
 	    <complexType name="NotificationType">
@@ -17,6 +22,7 @@
 		</sequence>
 		<anyAttribute namespace="##other" processContents="lax"/>
 	    </complexType>
+          <!--
 	    <complexType name="ExceptionType">
 		<sequence>
 		    <element name="soapFaultType" type="string"/>
@@ -26,6 +32,7 @@
 		</sequence>
 		<anyAttribute namespace="##other" processContents="lax"/>
 	    </complexType>
+	    -->
 	    <!-- Coordinator accepts -->
 	    <element name="Complete" type="wsarjtx:NotificationType"/>
 	    <element name="Close" type="wsarjtx:NotificationType"/>
@@ -35,7 +42,6 @@
 	    <element name="Closed" type="wsarjtx:NotificationType"/>
 	    <element name="Cancelled" type="wsarjtx:NotificationType"/>
 	    <element name="Faulted" type="wsarjtx:NotificationType"/>
-	    <element name="Fault" type="wsarjtx:ExceptionType"/>
 	  </schema>
         </wsdl:types> 
 	<!-- Messages -->
@@ -60,8 +66,8 @@
 	<wsdl:message name="FaultedMessage">
 		<wsdl:part name="parameters" element="wsarjtx:Faulted"/>
 	</wsdl:message>
-	<wsdl:message name="FaultMessage">
-		<wsdl:part name="parameters" element="wsarjtx:Fault"/>
+	<wsdl:message name="FaultWrapper">
+		<wsdl:part name="parameters" element="soapenv:Fault"/>
 	</wsdl:message>
 	<!-- Asynchronous Messaging PortTypes -->
 	<wsdl:portType name="TerminationCoordinatorPortType">
@@ -89,7 +95,21 @@
 			<wsdl:input message="wsarjtx:FaultedMessage" name="Faulted"/>
 		</wsdl:operation>
 		<wsdl:operation name="FaultOperation">
-			<wsdl:input message="wsarjtx:FaultMessage" name="Fault"/>
+			<wsdl:input message="wsarjtx:FaultWrapper" name="Fault"/>
 		</wsdl:operation>
 	</wsdl:portType>
+    <wsdl:portType name="TerminationCoordinatorRPCPortType">
+        <wsdl:operation name="CompleteOperation">
+            <wsdl:input message="wsarjtx:CompleteMessage" name="Complete"/>
+            <wsdl:output message="wsarjtx:CompletedMessage" name="Completed"/>
+        </wsdl:operation>
+        <wsdl:operation name="CloseOperation">
+            <wsdl:input message="wsarjtx:CloseMessage" name="Close"/>
+            <wsdl:output message="wsarjtx:ClosedMessage" name="Closed"/>
+        </wsdl:operation>
+        <wsdl:operation name="CancelOperation">
+            <wsdl:input message="wsarjtx:CancelMessage" name="Cancel"/>
+            <wsdl:output message="wsarjtx:CancelledMessage" name="Cancelled"/>
+        </wsdl:operation>
+    </wsdl:portType>
 </wsdl:definitions>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/build.sh
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/build.sh	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/build.sh	2010-09-01 14:09:52 UTC (rev 34953)
@@ -44,6 +44,8 @@
 
 $JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsat-completion-initiator-binding.wsdl -o tmp/classes -s tmp/src wsdl/wsat-completion-initiator-binding.wsdl
 
+$JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsat-completion-coordinator-rpc-binding.wsdl -o tmp/classes -s tmp/src wsdl/wsat-completion-coordinator-rpc-binding.wsdl
+
 $JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsat-coordinator-binding.wsdl -o tmp/classes -s tmp/src wsdl/wsat-coordinator-binding.wsdl
 
 $JBOSS_HOME/bin/wsconsume.sh -v -k -w wsdl/wsat-participant-binding.wsdl -o tmp/classes -s tmp/src wsdl/wsat-participant-binding.wsdl
@@ -70,6 +72,7 @@
 sed -i -e 's/ParticipantService.class.getResource(".")/ParticipantService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsat/_2006/_06/ParticipantService.java
 sed -i -e 's/CompletionInitiatorService.class.getResource(".")/CompletionInitiatorService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionInitiatorService.java
 sed -i -e 's/CompletionCoordinatorService.class.getResource(".")/CompletionCoordinatorService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorService.java
+sed -i -e 's/CompletionCoordinatorRPCService.class.getResource(".")/CompletionCoordinatorRPCService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCService.java
 
 sed -i -e 's/BusinessAgreementWithCoordinatorCompletionCoordinatorService.class.getResource(".")/BusinessAgreementWithCoordinatorCompletionCoordinatorService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsba/_2006/_06/BusinessAgreementWithCoordinatorCompletionCoordinatorService.java
 sed -i -e 's/BusinessAgreementWithCoordinatorCompletionParticipantService.class.getResource(".")/BusinessAgreementWithCoordinatorCompletionParticipantService.class.getResource("")/' tmp/src/org/oasis_open/docs/ws_tx/wsba/_2006/_06/BusinessAgreementWithCoordinatorCompletionParticipantService.java

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat-completion-coordinator-rpc-binding.wsdl (from rev 34881, labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat-completion-coordinator-binding.wsdl)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat-completion-coordinator-rpc-binding.wsdl	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat-completion-coordinator-rpc-binding.wsdl	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+                  xmlns:wsa="http://www.w3.org/2005/08/addressing"
+                  xmlns:wsat="http://docs.oasis-open.org/ws-tx/wsat/2006/06"
+                  targetNamespace="http://docs.oasis-open.org/ws-tx/wsat/2006/06"
+                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                  xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl">
+
+   <wsdl:import
+      namespace="http://docs.oasis-open.org/ws-tx/wsat/2006/06"
+      location="wsat.wsdl" />
+
+    <wsdl:types>
+        <xs:schema targetNamespace="http://docs.oasis-open.org/ws-tx/wsat/2006/06">
+            <xs:element name="Result" type="xs:boolean"/>
+        </xs:schema>
+    </wsdl:types>
+
+    <wsdl:message name="Result">
+        <wsdl:part name="result" element="wsat:Result"/>
+    </wsdl:message>
+
+    <wsdl:portType name="CompletionCoordinatorRPCPortType">
+        <wsdl:operation name="CommitOperation">
+            <wsdl:input message="wsat:Commit"/>
+            <wsdl:output message="wsat:Result"/>
+        </wsdl:operation>
+        <wsdl:operation name="RollbackOperation">
+            <wsdl:input message="wsat:Rollback"/>
+            <wsdl:output message="wsat:Result"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+  <wsdl:binding name="CompletionCoordinatorRPC_SOAPBinding" type="wsat:CompletionCoordinatorRPCPortType">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="CommitOperation">
+      <soap:operation soapAction="http://docs.oasis-open.org/ws-tx/wsat/2006/06/Commit" style="document"/>
+        <wsdl:input>
+          <soap:body use="literal"/>
+        </wsdl:input>
+        <wsdl:output>
+          <soap:body use="literal"/>
+        </wsdl:output>
+    </wsdl:operation>
+
+    <wsdl:operation name="RollbackOperation">
+      <soap:operation soapAction="http://docs.oasis-open.org/ws-tx/wsat/2006/06/Rollback" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+        <wsdl:output>
+          <soap:body use="literal"/>
+        </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+
+  <wsdl:service name="CompletionCoordinatorRPCService">
+    <wsdl:port binding="wsat:CompletionCoordinatorRPC_SOAPBinding" name="CompletionCoordinatorRPCPortType">
+      <soap:address location="http://localhost:9000/wst11/CompletionCoordinatorRPCService"/>
+       <wsaw:UsingAddressing required="true"/>
+    </wsdl:port>
+  </wsdl:service>
+
+</wsdl:definitions>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat.wsdl
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat.wsdl	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/dd/wscoor1.1/wsdl/wsat.wsdl	2010-09-01 14:09:52 UTC (rev 34953)
@@ -49,7 +49,14 @@
     <wsdl:message name="Committed">
         <wsdl:part name="parameters" element="wsat:Committed"/>
     </wsdl:message>
-    <wsdl:message name="SoapFault">
+    <!--
+    the WS-TX spec requires us to deliver asynchronous soap faults as a one way message payload
+    directed to the service endpoints but it does not specify any operations or messages in the
+    wsdl for this purpose. this message is used to define a soapenv:Fault payload which is used
+    by SoapFault operations added to the 3 WS-T ports which need to be able to receive an incoming
+    soap fault.
+    -->
+    <wsdl:message name="FaultWrapper">
         <wsdl:part name="parameters" element="soapenv:Fault"/>
     </wsdl:message>
     <!-- Port Types -->
@@ -69,7 +76,7 @@
             <wsdl:input message="wsat:Aborted"/>
         </wsdl:operation>
         <wsdl:operation name="SoapFault">
-            <wsdl:input message="wsat:SoapFault"/>
+            <wsdl:input message="wsat:FaultWrapper"/>
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:portType name="CoordinatorPortType">
@@ -86,7 +93,7 @@
             <wsdl:input message="wsat:Committed"/>
         </wsdl:operation>
         <wsdl:operation name="SoapFault">
-            <wsdl:input message="wsat:SoapFault"/>
+            <wsdl:input message="wsat:FaultWrapper"/>
         </wsdl:operation>
     </wsdl:portType>
     <wsdl:portType name="ParticipantPortType">
@@ -100,7 +107,7 @@
             <wsdl:input message="wsat:Rollback"/>
         </wsdl:operation>
         <wsdl:operation name="SoapFault">
-            <wsdl:input message="wsat:SoapFault"/>
+            <wsdl:input message="wsat:FaultWrapper"/>
         </wsdl:operation>
     </wsdl:portType>
 </wsdl:definitions>

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/ArjunaTXConstants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/ArjunaTXConstants.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src/com/arjuna/webservices/wsarjtx/ArjunaTXConstants.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -180,14 +180,28 @@
     /**
      * The unknown error error code.
      */
+    public static final String FAULTED_ERROR_CODE       = "Faulted";
+    /**
+     * The faulted error code.
+     */
+    public static final QName  FAULTED_ERROR_CODE_QNAME = new QName(WSARJTX_NAMESPACE, FAULTED_ERROR_CODE, WSARJTX_PREFIX);
+    
+    /**
+     * The faulted error code.
+     */
     public static final String UNKNOWNERROR_ERROR_CODE       = "UnknownError";
     /**
      * The unknown error error code.
      */
     public static final QName  UNKNOWNERROR_ERROR_CODE_QNAME = new QName(WSARJTX_NAMESPACE, UNKNOWNERROR_ERROR_CODE, WSARJTX_PREFIX);
-    
+
     /**
      * The termination protocol.
      */
     public String WSARJTX_PROTOCOL_TERMINATION = WSARJTX_NAMESPACE + "/BATermination";
+
+    /**
+     * The RPC termination protocol.
+     */
+    public String WSARJTX_PROTOCOL_TERMINATION_RPC = WSARJTX_NAMESPACE + "/BATerminationRPC";
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationParticipantPortType.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationParticipantPortType.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/schemas/ws/_2005/_10/wsarjtx/TerminationParticipantPortType.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -1,6 +1,8 @@
 
 package com.arjuna.schemas.ws._2005._10.wsarjtx;
 
+import org.xmlsoap.schemas.soap.envelope.Fault;
+
 import javax.jws.Oneway;
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
@@ -71,6 +73,5 @@
     @Oneway
     public void faultOperation(
         @WebParam(name = "Fault", targetNamespace = "http://schemas.arjuna.com/ws/2005/10/wsarjtx", partName = "parameters")
-        ExceptionType parameters);
-
+        Fault parameters);
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/ArjunaTX11Constants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/ArjunaTX11Constants.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/ArjunaTX11Constants.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -65,4 +65,22 @@
      * The termination coordinator soap service port qname
      */
      public QName TERMINATION_COORDINATOR_PORT_QNAME = new QName(ArjunaTXConstants.WSARJTX_NAMESPACE, TERMINATION_COORDINATOR_PORT_NAME, ArjunaTXConstants.WSARJTX_PREFIX);
+
+    /**
+     * The termination coordinator service name.
+     */
+    public String TERMINATION_COORDINATOR_RPC_SERVICE_NAME = "TerminationCoordinatorRPCService" ;
+    /**
+     * The termination coordinator service qname.
+     */
+    public QName TERMINATION_COORDINATOR_RPC_SERVICE_QNAME = new QName(ArjunaTXConstants.WSARJTX_NAMESPACE, TERMINATION_COORDINATOR_RPC_SERVICE_NAME, ArjunaTXConstants.WSARJTX_PREFIX) ;
+
+    /**
+     * The termination coordinator soap service port name
+     */
+     public String TERMINATION_COORDINATOR_RPC_PORT_NAME = "TerminationCoordinatorRPCPortType";
+    /**
+     * The termination coordinator soap service port qname
+     */
+     public QName TERMINATION_COORDINATOR_RPC_PORT_QNAME = new QName(ArjunaTXConstants.WSARJTX_NAMESPACE, TERMINATION_COORDINATOR_RPC_PORT_NAME, ArjunaTXConstants.WSARJTX_PREFIX);
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -62,10 +62,6 @@
      * The cancel action.
      */
     private String cancelAction = null;
-    /**
-     * The SOAP fault action.
-     */
-    private String faultAction = null;
 
     /**
      * The participant URI for replies.
@@ -87,15 +83,6 @@
         completeAction = ArjunaTXConstants.WSARJTX_ACTION_COMPLETE;
         closeAction = ArjunaTXConstants.WSARJTX_ACTION_CLOSE;
         cancelAction = ArjunaTXConstants.WSARJTX_ACTION_CANCEL;
-        faultAction = ArjunaTXConstants.WSARJTX_ACTION_SOAP_FAULT ;
-
-        final String terminationParticipantURIString =
-            ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_NAME, false);
-        final String secureTerminationParticipantURIString =
-            ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_NAME, true);
-
-        terminationParticipant = builder.newEndpoint(terminationParticipantURIString);
-        secureTerminationParticipant = builder.newEndpoint(secureTerminationParticipantURIString);
     }
 
     /**

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorRPCClient.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorRPCClient.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorRPCClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.webservices11.wsarjtx.client;
+
+import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
+import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationCoordinatorPortType;
+import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationCoordinatorRPCPortType;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.EndpointHelper;
+import com.arjuna.webservices11.wsaddr.NativeEndpointReference;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
+import org.jboss.wsf.common.addressing.MAP;
+import org.jboss.wsf.common.addressing.MAPBuilder;
+import org.jboss.wsf.common.addressing.MAPBuilderFactory;
+import org.jboss.wsf.common.addressing.MAPEndpoint;
+
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import java.io.IOException;
+
+/**
+ * The client side which makes synchronous requests to the BA termination coordinator using an RPC MEP.
+ * @author kevin
+ */
+public class TerminationCoordinatorRPCClient
+{
+    /**
+     * The client singleton.
+     */
+    private static final TerminationCoordinatorRPCClient CLIENT = new TerminationCoordinatorRPCClient() ;
+
+    /**
+     * The complete action.
+     */
+    private String completeAction = null;
+    /**
+     * The close action.
+     */
+    private String closeAction = null;
+    /**
+     * The cancel action.
+     */
+    private String cancelAction = null;
+
+    /**
+     * Construct the terminator participant client.
+     */
+    private TerminationCoordinatorRPCClient()
+    {
+        MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
+        completeAction = ArjunaTXConstants.WSARJTX_ACTION_COMPLETE;
+        closeAction = ArjunaTXConstants.WSARJTX_ACTION_CLOSE;
+        cancelAction = ArjunaTXConstants.WSARJTX_ACTION_CANCEL;
+    }
+
+    /**
+     * Send a complete request.
+     * @param map addressing context initialised with to and message ID.
+     * @param identifier The identifier of the initiator.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public void sendComplete(final W3CEndpointReference coordinator, final MAP map, final InstanceIdentifier identifier)
+        throws SoapFault11, IOException
+    {
+        final TerminationCoordinatorRPCPortType port = getPort(coordinator, map, completeAction);
+        final NotificationType complete = new NotificationType();
+
+        try {
+            port.completeOperation(complete);
+        } catch (SOAPFaultException sfe) {
+            throw SoapFault11.create(sfe);
+        }
+    }
+
+    /**
+     * Send a close request.
+     * @param map addressing context initialised with to and message ID.
+     * @param identifier The identifier of the initiator.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public void sendClose(final W3CEndpointReference coordinator, final MAP map, final InstanceIdentifier identifier)
+        throws SoapFault11, IOException
+    {
+        final TerminationCoordinatorRPCPortType port = getPort(coordinator, map, closeAction);
+        final NotificationType close = new NotificationType();
+
+        try {
+            port.closeOperation(close);
+        } catch (SOAPFaultException sfe) {
+            throw SoapFault11.create(sfe);
+        }
+    }
+
+    /**
+     * Send a cancel request.
+     * @param map addressing context initialised with to and message ID.
+     * @param identifier The identifier of the initiator.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public void sendCancel(final W3CEndpointReference coordinator, final MAP map, final InstanceIdentifier identifier)
+        throws SoapFault11, IOException
+    {
+        final TerminationCoordinatorRPCPortType port = getPort(coordinator, map, cancelAction);
+        final NotificationType cancel = new NotificationType();
+
+        try {
+            port.cancelOperation(cancel);
+        } catch (SOAPFaultException sfe) {
+            throw SoapFault11.create(sfe);
+        }
+    }
+
+    /**
+     * Get the Terminator Coordinator client singleton.
+     * @return The Terminator Coordinator client singleton.
+     */
+    public static TerminationCoordinatorRPCClient getClient()
+    {
+        return CLIENT ;
+    }
+
+    private TerminationCoordinatorRPCPortType getPort(final W3CEndpointReference endpoint,
+                                                      final MAP map,
+                                                      final String action)
+    {
+        return WSARJTXClient.getTerminationCoordinatorRPCPort(endpoint,  action, map);
+    }
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationParticipantClient.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationParticipantClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -25,6 +25,7 @@
 import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantPortType;
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import com.arjuna.webservices11.wsaddr.NativeEndpointReference;
@@ -39,6 +40,7 @@
 import org.jboss.wsf.common.addressing.MAP;
 import org.jboss.wsf.common.addressing.MAPBuilder;
 import org.jboss.wsf.common.addressing.MAPBuilderFactory;
+import org.xmlsoap.schemas.soap.envelope.Fault;
 
 /**
  * The Client side of the Terminator Coordinator.
@@ -189,14 +191,8 @@
         //AddressingHelper.installFrom(map, terminationCoordinator, identifier);
         AddressingHelper.installNoneReplyTo(map);
         final TerminationParticipantPortType port = getPort(endpoint, map, identifier, soapFaultAction);
-        final ExceptionType fault = new ExceptionType();
-        // we pass the fault type, reason and subcode. we cannot pass the detail and header elements as they are
-        // built from Kev's element types rather than dom element types. this is all we need anyway since we only
-        // see faults containing those values
-        fault.setSoapFaultType(soapFault.getSoapFaultType().getValue());
-        fault.setReason(soapFault.getReason());
-        fault.setSubCode(soapFault.getSubcode());
-
+        SoapFault11 soapFault11 = (SoapFault11)soapFault;
+        Fault fault = soapFault11.toFault();
         port.faultOperation(fault);
     }
 
@@ -212,14 +208,8 @@
         throws SoapFault, IOException
     {
         final TerminationParticipantPortType port = getPort(map, identifier, soapFaultAction);
-        final ExceptionType fault = new ExceptionType();
-        // we pass the fault type, reason and subcode. we cannot pass the detail and header elements as they are
-        // built from Kev's element types rather than dom element types. this is all we need anyway since we only
-        // see faults containing those values
-        fault.setSoapFaultType(soapFault.getSoapFaultType().getValue());
-        fault.setReason(soapFault.getReason());
-        fault.setSubCode(soapFault.getSubcode());
-
+        SoapFault11 soapFault11 = (SoapFault11)soapFault;
+        Fault fault = soapFault11.toFault();
         port.faultOperation(fault);
     }
 

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/WSARJTXClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/WSARJTXClient.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/WSARJTXClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -1,9 +1,6 @@
 package com.arjuna.webservices11.wsarjtx.client;
 
-import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationCoordinatorPortType;
-import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationCoordinatorService;
-import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantPortType;
-import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantService;
+import com.arjuna.schemas.ws._2005._10.wsarjtx.*;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.jboss.wsf.common.addressing.MAPBuilder;
@@ -38,6 +35,11 @@
     private static ThreadLocal<TerminationParticipantService> terminationParticipantService = new ThreadLocal<TerminationParticipantService>();
 
     /**
+     *  thread local which maintains a per thread termination coordinator service instance
+     */
+    private static ThreadLocal<TerminationCoordinatorRPCService> terminationCoordinatorRPCService = new ThreadLocal<TerminationCoordinatorRPCService>();
+
+    /**
      *  builder used to construct addressing info for calls
      */
     private static MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
@@ -68,6 +70,19 @@
         return terminationParticipantService.get();
     }
 
+    /**
+     * fetch a termination coordinator service unique to the current thread
+     * @return
+     */
+    private static synchronized TerminationCoordinatorRPCService getTerminationCoordinatorRPCService()
+    {
+        if (terminationCoordinatorRPCService.get() == null) {
+            //terminationCoordinatorService.set(new TerminationCoordinatorService(null, new QName("http://schemas.arjuna.com/ws/2005/10/wsarjtx", "TerminationCoordinatorService")));
+            terminationCoordinatorRPCService.set(new TerminationCoordinatorRPCService());
+        }
+        return terminationCoordinatorRPCService.get();
+    }
+
     public static TerminationCoordinatorPortType getTerminationCoordinatorPort(W3CEndpointReference endpointReference,
                                                                                 String action,
                                                                                 MAP map)
@@ -133,4 +148,25 @@
         AddressingHelper.configureRequestContext(requestContext, map, map.getTo(), action);
         return port;
     }
+    public static TerminationCoordinatorRPCPortType getTerminationCoordinatorRPCPort(W3CEndpointReference endpointReference,
+                                                                                  String action,
+                                                                                  MAP map)
+    {
+        TerminationCoordinatorRPCService service = getTerminationCoordinatorRPCService();
+        TerminationCoordinatorRPCPortType port = service.getPort(endpointReference, TerminationCoordinatorRPCPortType.class, new AddressingFeature(true, true));
+        BindingProvider bindingProvider = (BindingProvider)port;
+        /*
+         * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+		customHandlerChain.add(new WSAddressingClientHandler());
+		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+         */
+
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        MAP requestMap = AddressingHelper.outboundMap(requestContext);
+        map.setAction(action);
+        AddressingHelper.installCallerProperties(map, requestMap);
+        AddressingHelper.configureRequestContext(requestContext, requestMap.getTo(), action);
+        return port;
+    }
 }
\ No newline at end of file

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorRPCProcessor.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorProcessor.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorRPCProcessor.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorRPCProcessor.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.webservices11.wsarjtx.processors;
+
+import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.wst11.BusinessActivityTerminator;
+import org.jboss.wsf.common.addressing.MAP;
+
+/**
+ * The Terminator Participant processor.
+ * @author kevin
+ */
+public abstract class TerminationCoordinatorRPCProcessor
+{
+    /**
+     * The participant processor.
+     */
+    private static TerminationCoordinatorRPCProcessor PROCESSOR ;
+
+    /**
+     * Get the processor.
+     * @return The processor.
+     */
+    public static TerminationCoordinatorRPCProcessor getProcessor()
+    {
+        return PROCESSOR ;
+    }
+
+    /**
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
+     */
+    public static TerminationCoordinatorRPCProcessor setProcessor(final TerminationCoordinatorRPCProcessor processor)
+    {
+        final TerminationCoordinatorRPCProcessor origProcessor = PROCESSOR ;
+        PROCESSOR = processor ;
+        return origProcessor ;
+    }
+
+    /**
+     * Cancel.
+     * @param cancel The cancel notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract void cancel(final NotificationType cancel, final MAP map,
+        final ArjunaContext arjunaContext);
+
+    /**
+     * Close.
+     * @param close The close notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract void close(final NotificationType close, final MAP map,
+        final ArjunaContext arjunaContext) ;
+
+    /**
+     * Complete.
+     * @param complete The complete notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract void complete(final NotificationType complete, final MAP map,
+        final ArjunaContext arjunaContext) ;
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationParticipantPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationParticipantPortTypeImpl.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationParticipantPortTypeImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -1,26 +1,22 @@
 
 package com.arjuna.webservices11.wsarjtx.sei;
 
-import com.arjuna.schemas.ws._2005._10.wsarjtx.ExceptionType;
 import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
 import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantPortType;
 import com.arjuna.services.framework.task.Task;
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
-import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.SoapFault11;
 import org.jboss.wsf.common.addressing.MAP;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor;
+import org.xmlsoap.schemas.soap.envelope.Fault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
 import javax.jws.soap.SOAPBinding;
-import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 import javax.xml.ws.soap.Addressing;
 
@@ -142,23 +138,13 @@
     @Oneway
     public void faultOperation(
         @WebParam(name = "Fault", targetNamespace = "http://schemas.arjuna.com/ws/2005/10/wsarjtx", partName = "parameters")
-        ExceptionType parameters)
+        Fault parameters)
     {
         MessageContext ctx = webServiceCtx.getMessageContext();
-        String soapFaultTypeName = parameters.getSoapFaultType();
-        String reason = parameters.getReason();
-        QName subcode = parameters.getSubCode();
-        final SoapFault soapFault;
         final MAP inboundMap = AddressingHelper.inboundMap(ctx);
         final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
-        try {
-            SoapFaultType soapFaultType = SoapFaultType.toState(soapFaultTypeName);
-            soapFault = new SoapFault11(soapFaultType, subcode, reason);
-        } catch (Exception e) {
-            String message = WSTLogger.i18NLogger.get_webservices11_wsarjtx_sei_TerminationParticipantPortTypeImpl_1();
-            throw new WebServiceException(message, e);
-        }
-
+        final SoapFault soapFault = SoapFault11.fromFault(parameters);
+    
         TaskManager.getManager().queueTask(new Task() {
             public void executeTask() {
                 TerminationParticipantProcessor.getProcessor().handleSoapFault(soapFault, inboundMap, arjunaContext);

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/server/TerminationCoordinatorRPCInitialisation.java (from rev 34834, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/server/TerminationCoordinatorInitialisation.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/server/TerminationCoordinatorRPCInitialisation.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/server/TerminationCoordinatorRPCInitialisation.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.webservices11.wsarjtx.server;
+
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
+import org.jboss.jbossts.xts.environment.WSCEnvironmentBean;
+import org.jboss.jbossts.xts.environment.XTSPropertyManager;
+
+/**
+ * Activate the Terminator Participant service
+ * @author kevin
+ */
+public class TerminationCoordinatorRPCInitialisation
+{
+    public static void startup()
+    {
+        final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+        WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
+        String bindAddress = wscEnvironmentBean.getBindAddress11();
+        int bindPort = wscEnvironmentBean.getBindPort11();
+        int secureBindPort = wscEnvironmentBean.getBindPortSecure11();
+
+        if (bindAddress == null) {
+            bindAddress = "127.0.0.1";
+        }
+
+        if (bindPort == 0) {
+            bindPort = 8080;
+        }
+
+        if (secureBindPort == 0) {
+            secureBindPort = 8443;
+        }
+
+        final String baseUri = "http://" +  bindAddress + ":" + bindPort + "/ws-t11-coordinator/";
+        final String uri = baseUri + ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_NAME;
+        final String secureBaseUri = "https://" +  bindAddress + ":" + secureBindPort + "/ws-t11-coordinator/";
+        final String secureUri = secureBaseUri + ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_NAME;
+
+        serviceRegistry.registerServiceProvider(ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_NAME, uri) ;
+        serviceRegistry.registerSecureServiceProvider(ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_NAME, secureUri) ;
+    }
+
+    public static void shutdown()
+    {
+    }
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/AtomicTransactionConstants.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/AtomicTransactionConstants.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/AtomicTransactionConstants.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -60,6 +60,24 @@
     public QName COMPLETION_INITIATOR_PORT_QNAME = new QName(WSAT_NAMESPACE, COMPLETION_INITIATOR_PORT_NAME, WSAT_PREFIX);
 
     /**
+     * The RPC completion coordinator service name.
+     */
+    public String COMPLETION_COORDINATOR_RPC_SERVICE_NAME = "CompletionCoordinatorRPCService" ;
+    /**
+     * The RPC completion coordinator service qname.
+     */
+    public QName COMPLETION_COORDINATOR_RPC_SERVICE_QNAME = new QName(WSAT_NAMESPACE, COMPLETION_COORDINATOR_RPC_SERVICE_NAME, WSAT_PREFIX);
+
+     /**
+     * The WSAT RPC Completion Cordinator Port Name.
+     */
+    public String COMPLETION_COORDINATOR_RPC_PORT_NAME = "CompletionCoordinatorRPCPortType";
+    /**
+     * The WSAT RPC Completion Cordinator Port QName.
+     */
+    public QName COMPLETION_COORDINATOR_RPC_PORT_QNAME = new QName(WSAT_NAMESPACE, COMPLETION_COORDINATOR_RPC_PORT_NAME, WSAT_PREFIX);
+
+    /**
      * The coordinator service name.
      */
     public String COORDINATOR_SERVICE_NAME = "CoordinatorService" ;
@@ -226,6 +244,10 @@
      */
     public String WSAT_SUB_PROTOCOL_COMPLETION = WSAT_NAMESPACE + "/Completion" ;
     /**
+     * The atomic transaction RPC completion protocol.
+     */
+    public String WSAT_SUB_PROTOCOL_COMPLETION_RPC = WSAT_NAMESPACE + "/CompletionRPC" ;
+    /**
      * The atomic transaction durable 2PC protocol.
      */
     public String WSAT_SUB_PROTOCOL_DURABLE_2PC = WSAT_NAMESPACE + "/Durable2PC" ;

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorRPCClient.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorClient.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorRPCClient.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorRPCClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,123 @@
+package com.arjuna.webservices11.wsat.client;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.util.InvalidEnumerationException;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import org.jboss.wsf.common.addressing.MAP;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionCoordinatorRPCPortType;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import java.io.IOException;
+import java.util.Locale;
+
+/**
+ * The Client side of the Completion Coordinator.
+ * @author kevin
+ */
+public class CompletionCoordinatorRPCClient
+{
+    /**
+     * The client singleton.
+     */
+    private static final CompletionCoordinatorRPCClient CLIENT = new CompletionCoordinatorRPCClient() ;
+
+    /**
+     * The commit action.
+     */
+    private String commitAction = null;
+    /**
+     * The rollback action.
+     */
+    private String rollbackAction = null;
+
+    /**
+     * Construct the completion coordinator client.
+     */
+    private CompletionCoordinatorRPCClient()
+    {
+            commitAction = AtomicTransactionConstants.WSAT_ACTION_COMMIT;
+            rollbackAction = AtomicTransactionConstants.WSAT_ACTION_ROLLBACK;
+        // final HandlerRegistry handlerRegistry = new HandlerRegistry() ;
+
+        // Add WS-Addressing
+        // AddressingPolicy.register(handlerRegistry) ;
+        // Add client policies
+        // ClientPolicy.register(handlerRegistry) ;
+    }
+
+    /**
+     * Send a commit request.
+     * @param map addressing context initialised with to and message ID.
+     * @param identifier The identifier of the initiator.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public boolean sendCommit(final W3CEndpointReference endpoint, final MAP map)
+        throws SoapFault, IOException
+    {
+        CompletionCoordinatorRPCPortType port = getPort(endpoint, map, commitAction);
+        Notification commit = new Notification();
+
+        try {
+            return port.commitOperation(commit);
+        } catch (SOAPFaultException sfe) {
+            throw SoapFault11.create(sfe);
+        }
+    }
+
+    /**
+     * Send a rollback request.
+     * @param map addressing context initialised with to and message ID.
+     * @param identifier The identifier of the initiator.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public boolean sendRollback(final W3CEndpointReference endpoint, final MAP map)
+        throws SoapFault, IOException
+    {
+        CompletionCoordinatorRPCPortType port = getPort(endpoint, map, rollbackAction);
+        Notification rollback = new Notification();
+
+        try {
+            return port.rollbackOperation(rollback);
+        } catch (SOAPFaultException sfe) {
+            throw SoapFault11.create(sfe);
+        }
+    }
+
+    /**
+     * Get the Completion Coordinator client singleton.
+     * @return The Completion Coordinator client singleton.
+     */
+    public static CompletionCoordinatorRPCClient getClient()
+    {
+        return CLIENT;
+    }
+
+    /**
+     * obtain a port from the completion coordinator endpoint configured with the instance identifier handler and the supplied
+     * addressing properties supplemented with the given action
+     * @param endpoint
+     * @param map
+     * @param action
+     * @return
+     */
+    private CompletionCoordinatorRPCPortType getPort(final W3CEndpointReference endpoint,
+                                                  final MAP map,
+                                                  final String action)
+    {
+        AddressingHelper.installNoneReplyTo(map);
+        return WSATClient.getCompletionCoordinatorRPCPort(endpoint, action, map);
+    }
+}

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/WSATClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/WSATClient.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/WSATClient.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -6,7 +6,6 @@
 import org.jboss.wsf.common.addressing.MAPBuilderFactory;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.*;
 
-import javax.xml.namespace.QName;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.soap.AddressingFeature;
@@ -43,6 +42,11 @@
     private static ThreadLocal<CompletionInitiatorService> completionInitiatorService = new ThreadLocal<CompletionInitiatorService>();
 
     /**
+     *  thread local which maintains a per thread completion coordinator service instance
+     */
+    private static ThreadLocal<CompletionCoordinatorRPCService> completionCoordinatorRPCService = new ThreadLocal<CompletionCoordinatorRPCService>();
+
+    /**
      *  builder used to construct addressing info for calls
      */
     private static MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
@@ -99,6 +103,18 @@
         return completionInitiatorService.get();
     }
 
+    /**
+     * fetch an RPC completion coordinator service unique to the current thread
+     * @return
+     */
+    private static synchronized CompletionCoordinatorRPCService getCompletionCoordinatorRPCService()
+    {
+        if (completionCoordinatorRPCService.get() == null) {
+            completionCoordinatorRPCService.set(new CompletionCoordinatorRPCService());
+        }
+        return completionCoordinatorRPCService.get();
+    }
+
     // fetch ports when we HAVE an endpoint
 
     public static CoordinatorPortType getCoordinatorPort(W3CEndpointReference endpointReference,
@@ -153,6 +169,19 @@
         return port;
     }
 
+    public static CompletionCoordinatorRPCPortType getCompletionCoordinatorRPCPort(W3CEndpointReference endpointReference,
+                                                                             String action,
+                                                                             MAP map)
+    {
+        CompletionCoordinatorRPCService service = getCompletionCoordinatorRPCService();
+        CompletionCoordinatorRPCPortType port = service.getPort(endpointReference, CompletionCoordinatorRPCPortType.class, new AddressingFeature(true, true));
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configureEndpointPort(bindingProvider, action, map);
+
+        return port;
+    }
+
     // fetch ports when we have NO endpoint
 
     public static CoordinatorPortType getCoordinatorPort(String action,

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/processors/CompletionCoordinatorRPCProcessor.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/processors/CompletionCoordinatorProcessor.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/processors/CompletionCoordinatorRPCProcessor.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/processors/CompletionCoordinatorRPCProcessor.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,72 @@
+package com.arjuna.webservices11.wsat.processors;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.wst.Vote;
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import org.jboss.wsf.common.addressing.MAP;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+/**
+ * The Completion Coordinator processor.
+ * @author kevin
+ */
+public abstract class CompletionCoordinatorRPCProcessor
+{
+    /**
+     * The coordinator processor.
+     */
+    private static CompletionCoordinatorRPCProcessor PROCESSOR ;
+
+    /**
+     * Get the processor.
+     * @return The processor.
+     */
+    public static synchronized CompletionCoordinatorRPCProcessor getProcessor()
+    {
+        return PROCESSOR;
+    }
+
+    /**
+     * Set the processor.
+     * @param processor The processor.
+     * @return The previous processor.
+     */
+    public static synchronized CompletionCoordinatorRPCProcessor setProcessor(final CompletionCoordinatorRPCProcessor processor)
+    {
+        final CompletionCoordinatorRPCProcessor origProcessor = PROCESSOR;
+        PROCESSOR = processor ;
+        return origProcessor ;
+    }
+
+    /**
+     * Activate the participant.
+     * @param participant The participant.
+     * @param identifier The identifier.
+     */
+    public abstract void activateParticipant(final CompletionCoordinatorParticipant participant, final String identifier) ;
+
+    /**
+     * Deactivate the participant.
+     * @param participant The participant.
+     */
+    public abstract void deactivateParticipant(final CompletionCoordinatorParticipant participant) ;
+
+    /**
+     * Commit.
+     * @param commit The commit notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract boolean commit(final Notification commit, final MAP map,
+        final ArjunaContext arjunaContext);
+
+    /**
+     * Rollback.
+     * @param rollback The rollback notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract boolean rollback(final Notification rollback, final MAP map,
+        final ArjunaContext arjunaContext);
+}

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionCoordinatorRPCPortTypeImpl.java (from rev 34835, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionCoordinatorPortTypeImpl.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionCoordinatorRPCPortTypeImpl.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionCoordinatorRPCPortTypeImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,70 @@
+package com.arjuna.webservices11.wsat.sei;
+
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorRPCProcessor;
+import org.jboss.wsf.common.addressing.MAP;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+import javax.annotation.Resource;
+import javax.jws.*;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.Addressing;
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1-b03-
+ * Generated source version: 2.0
+ *
+ */
+ at WebService(name = "CompletionCoordinatorRPCPortType", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06",
+        // wsdlLocation = "/WEB-INF/wsdl/wsat-completion-coordinator-binding.wsdl",
+        serviceName = "CompletionCoordinatorRPCService",
+        portName = "CompletionCoordinatorRPCPortType"
+)
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+ at HandlerChain(file="/ws-t-rpc_handlers.xml")
+ at Addressing(required=true)
+public class CompletionCoordinatorRPCPortTypeImpl // implements CompletionCoordinatorPortType
+{
+    @Resource
+    private WebServiceContext webServiceCtx;
+
+    /**
+     *
+     * @param parameters
+     */
+    @WebMethod(operationName = "CommitOperation", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Commit")
+    @WebResult(name = "Result", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "result")
+    public boolean commitOperation(
+        @WebParam(name = "Commit", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "parameters")
+        Notification parameters)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final Notification commit = parameters;
+        final MAP inboundMap = AddressingHelper.inboundMap(ctx);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+
+        return CompletionCoordinatorRPCProcessor.getProcessor().commit(commit, inboundMap, arjunaContext) ;
+    }
+
+    /**
+     *
+     * @param parameters
+     */
+    @WebMethod(operationName = "RollbackOperation", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Rollback")
+    @WebResult(name = "Result", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "result")
+    public boolean rollbackOperation(
+        @WebParam(name = "Rollback", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "parameters")
+        Notification parameters)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final Notification rollback = parameters;
+        final MAP inboundMap = AddressingHelper.inboundMap(ctx);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+
+        return CompletionCoordinatorRPCProcessor.getProcessor().rollback(rollback, inboundMap, arjunaContext) ;
+    }
+}

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/server/CompletionCoordinatorRPCInitialisation.java (from rev 34834, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/server/CompletionCoordinatorInitialisation.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/server/CompletionCoordinatorRPCInitialisation.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/server/CompletionCoordinatorRPCInitialisation.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.webservices11.wsat.server;
+
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import org.jboss.jbossts.xts.environment.WSCEnvironmentBean;
+import org.jboss.jbossts.xts.environment.XTSPropertyManager;
+
+/**
+ * Activate the Completion Coordinator service
+ * @author kevin
+ */
+public class CompletionCoordinatorRPCInitialisation
+{
+    public static void startup()
+    {
+        final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+        WSCEnvironmentBean wscEnvironmentBean = XTSPropertyManager.getWSCEnvironmentBean();
+        String bindAddress = wscEnvironmentBean.getBindAddress11();
+        int bindPort = wscEnvironmentBean.getBindPort11();
+        int secureBindPort = wscEnvironmentBean.getBindPortSecure11();
+
+
+        if (bindAddress == null) {
+            bindAddress = "127.0.0.1";
+        }
+
+        if (bindPort == 0) {
+            bindPort = 8080;
+        }
+
+        if (secureBindPort == 0) {
+            secureBindPort = 8443;
+        }
+
+        final String baseUri = "http://" +  bindAddress + ":" + bindPort + "/ws-t11-coordinator/";
+        final String uri = baseUri + AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_NAME;
+        final String secureBaseUri = "https://" +  bindAddress + ":" + secureBindPort + "/ws-t11-coordinator/";
+        final String secureUri = secureBaseUri + AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_NAME;
+
+        serviceRegistry.registerServiceProvider(AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_NAME, uri) ;
+        serviceRegistry.registerSecureServiceProvider(AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_NAME, secureUri) ;
+    }
+
+    public static void shutdown()
+    {
+    }
+}
\ No newline at end of file

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CompletionCoordinatorRPCProcessorImpl.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CompletionCoordinatorProcessorImpl.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CompletionCoordinatorRPCProcessorImpl.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CompletionCoordinatorRPCProcessorImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,197 @@
+package com.arjuna.wst11.messaging;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
+import com.arjuna.webservices.logging.WSTLogger;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorRPCProcessor;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.*;
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+import org.jboss.wsf.common.addressing.MAP;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+/**
+ * The Completion Coordinator processor.
+ * @author kevin
+ */
+public class CompletionCoordinatorRPCProcessorImpl extends CompletionCoordinatorRPCProcessor
+{
+    /**
+     * The activated object processor.
+     */
+    private final ActivatedObjectProcessor activatedObjectProcessor = new ActivatedObjectProcessor() ;
+
+    /**
+     * Activate the participant.
+     * @param participant The participant.
+     * @param identifier The identifier.
+     */
+    public void activateParticipant(final CompletionCoordinatorParticipant participant, final String identifier)
+    {
+        activatedObjectProcessor.activateObject(participant, identifier) ;
+    }
+
+    /**
+     * Deactivate the participant.
+     * @param participant The participant.
+     */
+    public void deactivateParticipant(final CompletionCoordinatorParticipant participant)
+    {
+        activatedObjectProcessor.deactivateObject(participant) ;
+    }
+
+    /**
+     * Get the participant with the specified identifier.
+     * @param instanceIdentifier The participant identifier.
+     * @return The participant or null if not known.
+     */
+    private CompletionCoordinatorParticipant getParticipant(final InstanceIdentifier instanceIdentifier)
+    {
+        final String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null) ;
+        return (CompletionCoordinatorParticipant)activatedObjectProcessor.getObject(identifier) ;
+    }
+
+    /**
+     * Commit.
+     * @param commit The commit notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public boolean commit(final Notification commit, final MAP map,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier) ;
+
+        {
+            try {
+            if (participant != null)
+            {
+                try
+                {
+                    participant.commit() ;
+                }
+                catch (final TransactionRolledBackException trbe)
+                {
+                    return false;
+                }
+                catch (final UnknownTransactionException ute)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_1());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final SystemException se)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_2(se));
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final Throwable th)
+                {
+                    if (WSTLogger.logger.isTraceEnabled())
+                    {
+                        WSTLogger.logger.tracev("Unexpected exception thrown from commit:", th) ;
+                    }
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_2(th));
+                    throw new SOAPFaultException(soapFault);
+                }
+
+                return true;
+            }
+            else
+            {
+                if (WSTLogger.logger.isTraceEnabled())
+                {
+                    WSTLogger.logger.tracev("Commit called on unknown participant: {0}", new Object[] {instanceIdentifier}) ;
+                }
+                SOAPFactory factory = SOAPFactory.newInstance();
+                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_5());
+                throw new SOAPFaultException(soapFault);
+            }
+            } catch (SOAPException se) {
+                se.printStackTrace(System.err);
+                throw new ProtocolException(se);
+            }
+        }
+    }
+
+    /**
+     * Rollback.
+     * @param rollback The rollback notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public boolean rollback(final Notification rollback, final MAP map,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier) ;
+
+        try
+        {
+            if (participant != null)
+            {
+                final String messageId = MessageId.getMessageId() ;
+                try
+                {
+                    participant.rollback() ;
+                    return true;
+                }
+                catch (final UnknownTransactionException ute)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_6());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final SystemException se)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_7(se));
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final Throwable th)
+                {
+                    if (WSTLogger.logger.isTraceEnabled())
+                    {
+                        WSTLogger.logger.tracev("Unexpected exception thrown from commit:", th) ;
+                    }
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_7(th));
+                    throw new SOAPFaultException(soapFault);
+                }
+            }
+            else
+            {
+                if (WSTLogger.logger.isTraceEnabled())
+                {
+                    WSTLogger.logger.tracev("Rollback called on unknown participant: {0}", new Object[] {instanceIdentifier}) ;
+                }
+                SOAPFactory factory = SOAPFactory.newInstance();
+                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_10());
+                throw new SOAPFaultException(soapFault);
+            }
+        } catch (SOAPException se) {
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
+        }
+    }
+}

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorRPCProcessorImpl.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorProcessorImpl.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorRPCProcessorImpl.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorRPCProcessorImpl.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,263 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package com.arjuna.wst11.messaging;
+
+import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
+import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
+import com.arjuna.webservices.logging.WSTLogger;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorProcessor;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorRPCProcessor;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.FaultedException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst11.BusinessActivityTerminator;
+import org.jboss.wsf.common.addressing.MAP;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPFault;
+import javax.xml.ws.ProtocolException;
+import javax.xml.ws.soap.SOAPFaultException;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+/**
+ * The Terminator Participant processor.
+ * @author kevin
+ *
+ */
+public class TerminationCoordinatorRPCProcessorImpl extends TerminationCoordinatorRPCProcessor
+{
+    /**
+     * Cancel.
+     * @param cancel The cancel notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void cancel(final NotificationType cancel, final MAP map, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier) ;
+
+        try
+        {
+            if (participant != null)
+            {
+                try
+                {
+                    participant.cancel() ;
+                }
+                catch (FaultedException fm)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME);
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final UnknownTransactionException ute)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final SystemException se)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2(se));
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final Throwable th)
+                {
+                    if (WSTLogger.logger.isTraceEnabled())
+                    {
+                        WSTLogger.logger.tracev("Unexpected exception thrown from close:", th) ;
+                    }
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2(th));
+                    throw new SOAPFaultException(soapFault);
+                }
+            }
+            else
+            {
+                if (WSTLogger.logger.isTraceEnabled())
+                {
+                    WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] {instanceIdentifier}) ;
+                }
+                SOAPFactory factory = SOAPFactory.newInstance();
+                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
+                throw new SOAPFaultException(soapFault);
+            }
+        }
+        catch (SOAPException se)
+        {
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
+        }
+    }
+
+    /**
+     * Close.
+     * @param close The close notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void close(final NotificationType close, final MAP map, final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier) ;
+
+        try
+        {
+            if (participant != null)
+            {
+                try
+                {
+                    participant.close() ;
+                }
+                catch (final UnknownTransactionException ute)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_6());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final TransactionRolledBackException trbe)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.TRANSACTIONROLLEDBACK_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_7());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final SystemException se)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_8(se));
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final Throwable th)
+                {
+                    if (WSTLogger.logger.isTraceEnabled())
+                    {
+                        WSTLogger.logger.tracev("Unexpected exception thrown from close:", th) ;
+                    }
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_8(th));
+                    throw new SOAPFaultException(soapFault);
+                }
+            }
+            else
+            {
+                if (WSTLogger.logger.isTraceEnabled())
+                {
+                    WSTLogger.logger.tracev("Close called on unknown participant: {0}", new Object[] {instanceIdentifier}) ;
+                }
+                SOAPFactory factory = SOAPFactory.newInstance();
+                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_6());
+                throw new SOAPFaultException(soapFault);
+            }
+        } catch (SOAPException se) {
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
+        }
+    }
+
+    /**
+     * Complete.
+     * @param complete The complete notification.
+     * @param map The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public void complete(final NotificationType complete, final MAP map,
+        final ArjunaContext arjunaContext)
+    {
+        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
+        final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier) ;
+
+        try {
+            if (participant != null)
+            {
+                W3CEndpointReference endpoint = participant.getEndpoint();
+
+                final String messageId = MessageId.getMessageId() ;
+                try
+                {
+                    participant.complete() ;
+                }
+                catch (FaultedException fm)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME);
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final UnknownTransactionException ute)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final SystemException se)
+                {
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13(se));
+                    throw new SOAPFaultException(soapFault);
+                }
+                catch (final Throwable th)
+                {
+                    if (WSTLogger.logger.isTraceEnabled())
+                    {
+                        WSTLogger.logger.tracev("Unexpected exception thrown from close:", th) ;
+                    }
+                    SOAPFactory factory = SOAPFactory.newInstance();
+                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
+                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13(th));
+                    throw new SOAPFaultException(soapFault);
+                }
+            }
+            else
+            {
+                if (WSTLogger.logger.isTraceEnabled())
+                {
+                    WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] {instanceIdentifier}) ;
+                }
+                SOAPFactory factory = SOAPFactory.newInstance();
+                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
+                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
+                throw new SOAPFaultException(soapFault);
+            }
+        } catch (SOAPException se) {
+            se.printStackTrace(System.err);
+            throw new ProtocolException(se);
+        }
+    }
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/deploy/WSTCoordinatorInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/deploy/WSTCoordinatorInitialisation.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/deploy/WSTCoordinatorInitialisation.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -21,7 +21,9 @@
 package com.arjuna.wst11.messaging.deploy;
 
 import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorProcessor;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorRPCProcessor;
 import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorRPCProcessor;
 import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
@@ -40,8 +42,10 @@
     public static void startup()
     {
         CompletionCoordinatorProcessor.setProcessor(new CompletionCoordinatorProcessorImpl()) ;
+        CompletionCoordinatorRPCProcessor.setProcessor(new CompletionCoordinatorRPCProcessorImpl()) ;
         CoordinatorProcessor.setProcessor(new CoordinatorProcessorImpl()) ;
         TerminationCoordinatorProcessor.setProcessor(new TerminationCoordinatorProcessorImpl()) ;
+        TerminationCoordinatorRPCProcessor.setProcessor(new TerminationCoordinatorRPCProcessorImpl()) ;
         CoordinatorCompletionCoordinatorProcessor.setProcessor(new CoordinatorCompletionCoordinatorProcessorImpl()) ;
         ParticipantCompletionCoordinatorProcessor.setProcessor(new ParticipantCompletionCoordinatorProcessorImpl()) ;
     }

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorRPCStub.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorRPCStub.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorRPCStub.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,358 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (c) 2003, Arjuna Technologies Limited.
+ *
+ * $Id: BusinessActivityTerminatorStub.java,v 1.7.6.1 2005/11/22 10:35:29 kconner Exp $
+ */
+
+package com.arjuna.wst11.stub;
+
+import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarjtx.client.TerminationCoordinatorClient;
+import com.arjuna.webservices11.wsarjtx.client.TerminationCoordinatorRPCClient;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantCallback;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.FaultedException;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst11.BusinessActivityTerminator;
+import org.jboss.wsf.common.addressing.MAP;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class BusinessActivityTerminatorRPCStub implements BusinessActivityTerminator
+{
+    private W3CEndpointReference _terminationCoordinator = null;
+    private final String _id ;
+
+    public BusinessActivityTerminatorRPCStub(final String id, final W3CEndpointReference terminationCoordinator)
+        throws Exception
+    {
+        _terminationCoordinator = terminationCoordinator;
+        _id = id ;
+    }
+
+    public void close ()
+        throws TransactionRolledBackException, UnknownTransactionException, SystemException
+    {
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+
+        try
+        {
+            TerminationCoordinatorRPCClient.getClient().sendClose(_terminationCoordinator, map, new InstanceIdentifier(_id)) ;
+        }
+        catch (SoapFault11 soapFault)
+        {
+            if ((ArjunaTXConstants.TRANSACTIONROLLEDBACK_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))) {
+                throw new TransactionRolledBackException(soapFault.getMessage());
+            }
+            else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
+            {
+                throw new UnknownTransactionException(soapFault.getMessage()) ;
+            }
+
+            throw new SystemException(soapFault.getMessage()) ;
+        }
+        catch (Exception e)
+        {
+            throw new SystemException();
+        }
+    }
+
+    public void cancel ()
+        throws FaultedException, UnknownTransactionException, SystemException
+    {
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+
+        try
+        {
+            TerminationCoordinatorRPCClient.getClient().sendCancel(_terminationCoordinator, map, new InstanceIdentifier(_id)) ;
+        }
+        catch (SoapFault11 soapFault)
+        {
+            if (ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
+            {
+                throw new FaultedException(soapFault.getMessage()) ;
+            }
+            else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
+            {
+                throw new UnknownTransactionException(soapFault.getMessage()) ;
+            }
+
+            throw new SystemException(soapFault.getMessage()) ;
+        }
+        catch (Exception e)
+        {
+            throw new SystemException(e.getMessage());
+        }
+        catch (final Throwable th)
+        {
+            th.printStackTrace() ;
+            throw new SystemException(th.getMessage()) ;
+        }
+    }
+
+    public void complete ()
+        throws FaultedException, UnknownTransactionException, SystemException
+    {
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+
+        try
+        {
+            TerminationCoordinatorRPCClient.getClient().sendComplete(_terminationCoordinator, map, new InstanceIdentifier(_id)) ;
+        }
+        catch (SoapFault11 soapFault)
+        {
+            if (ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
+            {
+                throw new FaultedException(soapFault.getMessage()) ;
+            }
+            else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode()))
+            {
+                throw new UnknownTransactionException(soapFault.getMessage()) ;
+            }
+
+            throw new SystemException(soapFault.getMessage()) ;
+        }
+        catch (Exception e)
+        {
+            throw new SystemException(e.getMessage());
+        }
+        catch (final Throwable th)
+        {
+            th.printStackTrace() ;
+            throw new SystemException(th.getMessage()) ;
+        }
+    }
+
+    public W3CEndpointReference getEndpoint()
+    {
+        return _terminationCoordinator;
+    }
+    /*
+     * this never gets called
+     */
+    public void unknown ()
+        throws SystemException
+    {
+        error() ;
+    }
+
+    /*
+     * this never gets called
+     */
+    public void error ()
+        throws SystemException
+    {
+/*
+ * Since it is never used this has been decommissioned due to problems with using the soap fault service to
+  * send a fault via a W3C endpoint. the latter is broken now that CXF helpfully puts metadata into the endpoint.
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+        final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME,
+                WSTLogger.i18NLogger.get_wst11_stub_BusinessActivityTerminatorStub_1()) ;
+        try
+        {
+            TerminationCoordinatorClient.getClient().sendSoapFault(_terminationCoordinator, map, soapFault, new InstanceIdentifier(_id)) ;
+        }
+        catch (final Throwable th)
+        {
+            throw new SystemException() ;
+        }
+*/
+    }
+
+    private static class RequestCallback extends TerminationParticipantCallback
+    {
+        /**
+         * The addressing context.
+         */
+        private MAP map ;
+        /**
+         * The arjuna context.
+         */
+        private ArjunaContext arjunaContext ;
+        /**
+         * The SOAP fault.
+         */
+        private SoapFault soapFault ;
+        /**
+         * The completed notification flag.
+         */
+        private boolean completed ;
+        /**
+         * The cancelled notification flag.
+         */
+        private boolean cancelled ;
+        /**
+         * The closed notification flag.
+         */
+        private boolean closed ;
+        /**
+         * The faulted notification flag.
+         */
+        private boolean faulted ;
+
+        /**
+         * Get the addressing context.
+         * @return The addressing context.
+         */
+        MAP getAddressingProperties()
+        {
+            return map ;
+        }
+
+        /**
+         * Get the arjuna context.
+         * @return The arjuna context.
+         */
+        ArjunaContext getArjunaContextWS()
+        {
+            return arjunaContext ;
+        }
+
+        /**
+         * Get the SOAP fault.
+         * @return The SOAP fault.
+         */
+        SoapFault getSoapFault()
+        {
+            return soapFault ;
+        }
+
+        /**
+         * Did we receive a completed notification?
+         * @return True if completed, false otherwise.
+         */
+        boolean receivedCompleted()
+        {
+            return completed ;
+        }
+
+        /**
+         * Did we receive a cancelled notification?
+         * @return True if cancelled, false otherwise.
+         */
+        boolean receivedCancelled()
+        {
+            return cancelled ;
+        }
+
+        /**
+         * Did we receive a closed notification?
+         * @return True if closed, false otherwise.
+         */
+        boolean receivedClosed()
+        {
+            return closed ;
+        }
+
+        /**
+         * Did we receive a faulted notification?
+         * @return True if faulted, false otherwise.
+         */
+        boolean receivedFaulted()
+        {
+            return faulted ;
+        }
+
+        /**
+         * A completed response.
+         * @param completed The completed notification.
+         * @param map The addressing context.
+         * @param arjunaContext The arjuna context.
+         */
+        public void completed(final NotificationType completed, final MAP map,
+            final ArjunaContext arjunaContext)
+        {
+            this.completed = true ;
+            this.map = map ;
+            this.arjunaContext = arjunaContext ;
+        }
+
+        /**
+         * A cancelled response.
+         * @param cancelled The cancelled notification.
+         * @param map The addressing context.
+         * @param arjunaContext The arjuna context.
+         */
+        public void cancelled(final NotificationType cancelled, final MAP map,
+            final ArjunaContext arjunaContext)
+        {
+            this.cancelled  = true ;
+            this.map = map ;
+            this.arjunaContext = arjunaContext ;
+        }
+
+        /**
+         * A closed response.
+         * @param closed The closed notification.
+         * @param map The addressing context.
+         * @param arjunaContext The arjuna context.
+         */
+        public void closed(final NotificationType closed, final MAP map,
+            final ArjunaContext arjunaContext)
+        {
+            this.closed = true ;
+            this.map = map ;
+            this.arjunaContext = arjunaContext ;
+        }
+
+        /**
+         * A faulted response.
+         * @param faulted The faulted notification.
+         * @param map The addressing context.
+         * @param arjunaContext The arjuna context.
+         */
+        public void faulted(final NotificationType faulted, final MAP map,
+            final ArjunaContext arjunaContext)
+        {
+            // TODO - convert wsdl to use NotificationType instead of ExceptionType
+            this.faulted = true ;
+            this.map = map ;
+            this.arjunaContext = arjunaContext ;
+        }
+
+        /**
+         * A SOAP fault response.
+         * @param soapFault The SOAP fault.
+         * @param map The addressing context.
+         * @param arjunaContext The arjuna context.
+         */
+        public void soapFault(final SoapFault soapFault, final MAP map,
+            final ArjunaContext arjunaContext)
+        {
+            // TODO - pass soap fault to this callback
+            this.soapFault = soapFault ;
+            this.map = map ;
+            this.arjunaContext = arjunaContext ;
+        }
+    }
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -28,10 +28,7 @@
 
 import com.arjuna.schemas.ws._2005._10.wsarjtx.NotificationType;
 import com.arjuna.webservices.SoapFault;
-import com.arjuna.webservices.SoapFaultType;
-import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
-import com.arjuna.webservices11.SoapFault11;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.jboss.wsf.common.addressing.MAP;
 import com.arjuna.webservices11.wsarj.ArjunaContext;

Copied: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionRPCStub.java (from rev 34619, labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionStub.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionRPCStub.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionRPCStub.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,89 @@
+package com.arjuna.wst11.stub;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.ArjunaContext;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsat.client.CompletionCoordinatorClient;
+import com.arjuna.webservices11.wsat.client.CompletionCoordinatorRPCClient;
+import com.arjuna.webservices11.wsat.processors.CompletionInitiatorCallback;
+import com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.CompletionCoordinatorParticipant;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import org.jboss.wsf.common.addressing.MAP;
+import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+public class CompletionRPCStub implements
+        CompletionCoordinatorParticipant
+{
+    private W3CEndpointReference _completionCoordinator = null;
+    private String _id;
+
+	public CompletionRPCStub(final String id, final W3CEndpointReference completionCoordinator)
+			throws Exception
+	{
+		_completionCoordinator = completionCoordinator;
+		_id = id;
+	}
+
+	public void commit () throws TransactionRolledBackException,
+            UnknownTransactionException, SystemException
+    {
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+        boolean result;
+
+        try
+        {
+            result = CompletionCoordinatorRPCClient.getClient().sendCommit(_completionCoordinator, map) ;
+        }
+        catch (final SoapFault soapFault)
+        {
+            if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
+                throw new UnknownTransactionException(soapFault.getMessage());
+            }
+            throw new SystemException(soapFault.getMessage()) ;
+        }
+        catch (final Exception e)
+        {
+            throw new SystemException(e.getMessage()) ;
+        }
+        catch (final Throwable th)
+        {
+            th.printStackTrace() ;
+            throw new SystemException(th.getMessage()) ;
+        }
+
+        if (!result) {
+            throw new TransactionRolledBackException() ;
+        }
+	}
+
+	public void rollback () throws UnknownTransactionException, SystemException
+	{
+        final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+
+        try
+        {
+            CompletionCoordinatorRPCClient.getClient().sendRollback(_completionCoordinator, map) ;
+        }
+        catch (final SoapFault soapFault)
+        {
+            if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
+                throw new UnknownTransactionException(soapFault.getMessage());
+            }
+            throw new SystemException(soapFault.getMessage()) ;
+        }
+        catch (final Throwable th)
+        {
+            th.printStackTrace() ;
+            throw new SystemException(th.getMessage()) ;
+        }
+	}
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCPortType.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCPortType.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCPortType.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,46 @@
+package org.oasis_open.docs.ws_tx.wsat._2006._06;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2-12/14/2009 02:16 PM(ramkris)-
+ * Generated source version: 2.2
+ * 
+ */
+ at WebService(name = "CompletionCoordinatorRPCPortType", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06")
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface CompletionCoordinatorRPCPortType {
+
+    /**
+     * 
+     * @param parameters
+     * @return
+     *     returns boolean
+     */
+    @WebMethod(operationName = "CommitOperation", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Commit")
+    @WebResult(name = "Result", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "result")
+    public boolean commitOperation(
+        @WebParam(name = "Commit", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "parameters")
+        Notification parameters)
+    ;
+
+    /**
+     * 
+     * @param parameters
+     * @return
+     *     returns boolean
+     */
+    @WebMethod(operationName = "RollbackOperation", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/Rollback")
+    @WebResult(name = "Result", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "result")
+    public boolean rollbackOperation(
+        @WebParam(name = "Rollback", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", partName = "parameters")
+        Notification parameters)
+    ;
+
+}

Added: labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCService.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCService.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/org/oasis_open/docs/ws_tx/wsat/_2006/_06/CompletionCoordinatorRPCService.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,77 @@
+package org.oasis_open.docs.ws_tx.wsat._2006._06;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2-12/14/2009 02:16 PM(ramkris)-
+ * Generated source version: 2.2
+ * 
+ */
+ at WebServiceClient(name = "CompletionCoordinatorRPCService", targetNamespace = "http://docs.oasis-open.org/ws-tx/wsat/2006/06", wsdlLocation = "wsdl/wsat-completion-coordinator-rpc-binding.wsdl")
+public class CompletionCoordinatorRPCService
+    extends Service
+{
+
+    private final static URL COMPLETIONCOORDINATORRPCSERVICE_WSDL_LOCATION;
+    private final static WebServiceException COMPLETIONCOORDINATORRPCSERVICE_EXCEPTION;
+    private final static QName COMPLETIONCOORDINATORRPCSERVICE_QNAME = new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CompletionCoordinatorRPCService");
+
+    static {
+        COMPLETIONCOORDINATORRPCSERVICE_WSDL_LOCATION = CompletionCoordinatorRPCService.class.getResource("wsdl/wsat-completion-coordinator-rpc-binding.wsdl");
+        WebServiceException e = null;
+        if (COMPLETIONCOORDINATORRPCSERVICE_WSDL_LOCATION == null) {
+            e = new WebServiceException("Cannot find 'wsdl/wsat-completion-coordinator-rpc-binding.wsdl' wsdl. Place the resource correctly in the classpath.");
+        }
+        COMPLETIONCOORDINATORRPCSERVICE_EXCEPTION = e;
+    }
+
+    public CompletionCoordinatorRPCService() {
+        super(__getWsdlLocation(), COMPLETIONCOORDINATORRPCSERVICE_QNAME);
+    }
+
+    public CompletionCoordinatorRPCService(URL wsdlLocation) {
+        super(wsdlLocation, COMPLETIONCOORDINATORRPCSERVICE_QNAME);
+    }
+
+    public CompletionCoordinatorRPCService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    /**
+     * 
+     * @return
+     *     returns CompletionCoordinatorRPCPortType
+     */
+    @WebEndpoint(name = "CompletionCoordinatorRPCPortType")
+    public CompletionCoordinatorRPCPortType getCompletionCoordinatorRPCPortType() {
+        return super.getPort(new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CompletionCoordinatorRPCPortType"), CompletionCoordinatorRPCPortType.class);
+    }
+
+    /**
+     * 
+     * @param features
+     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
+     * @return
+     *     returns CompletionCoordinatorRPCPortType
+     */
+    @WebEndpoint(name = "CompletionCoordinatorRPCPortType")
+    public CompletionCoordinatorRPCPortType getCompletionCoordinatorRPCPortType(WebServiceFeature... features) {
+        return super.getPort(new QName("http://docs.oasis-open.org/ws-tx/wsat/2006/06", "CompletionCoordinatorRPCPortType"), CompletionCoordinatorRPCPortType.class, features);
+    }
+
+    private static URL __getWsdlLocation() {
+        if (COMPLETIONCOORDINATORRPCSERVICE_EXCEPTION!= null) {
+            throw COMPLETIONCOORDINATORRPCSERVICE_EXCEPTION;
+        }
+        return COMPLETIONCOORDINATORRPCSERVICE_WSDL_LOCATION;
+    }
+
+}

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/RegistrarImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/RegistrarImple.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/RegistrarImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -12,10 +12,12 @@
 import com.arjuna.mwlabs.wst11.at.participants.CompletionCoordinatorImple;
 import com.arjuna.mwlabs.wst.at.participants.DurableTwoPhaseCommitParticipant;
 import com.arjuna.mwlabs.wst.at.participants.VolatileTwoPhaseCommitParticipant;
+import com.arjuna.mwlabs.wst11.at.participants.CompletionCoordinatorRPCImple;
 import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorRPCProcessor;
 import com.arjuna.wsc.*;
 import com.arjuna.wst11.CompletionCoordinatorParticipant;
 import com.arjuna.wst11.stub.Durable2PCStub;
@@ -39,7 +41,8 @@
 
 		mapper.addRegistrar(AtomicTransactionConstants.WSAT_SUB_PROTOCOL_DURABLE_2PC, this);
 		mapper.addRegistrar(AtomicTransactionConstants.WSAT_SUB_PROTOCOL_VOLATILE_2PC, this);
-		mapper.addRegistrar(AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION, this);
+        mapper.addRegistrar(AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION, this);
+        mapper.addRegistrar(AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION_RPC, this);
 	}
 
 	/**
@@ -173,6 +176,24 @@
 				throw new InvalidStateException(ex.toString());
 			}
 		}
+        else if (AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION_RPC.equals(protocolIdentifier))
+        {
+            try
+            {
+                final CompletionCoordinatorParticipant participant = new CompletionCoordinatorRPCImple(_coordManager, hier, true, participantProtocolService) ;
+                CompletionCoordinatorRPCProcessor.getProcessor().activateParticipant(participant, instanceIdentifier.getInstanceIdentifier()) ;
+
+                _coordManager.suspend();
+
+                return getCompletionCoordinatorRPC(instanceIdentifier, isSecure) ;
+            }
+            catch (Exception ex)
+            {
+                ex.printStackTrace();
+
+                throw new InvalidStateException(ex.toString());
+            }
+        }
 		else {
             wstxLogger.i18NLogger.warn_mwlabs_wst_at_Registrar11Imple_1(AtomicTransactionConstants.WSAT_PROTOCOL, protocolIdentifier);
 
@@ -279,6 +300,17 @@
         return builder.build();
     }
 
+    private W3CEndpointReference getCompletionCoordinatorRPC(final InstanceIdentifier instanceIdentifier, final boolean isSecure)
+    {
+        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+        String address = ServiceRegistry.getRegistry().getServiceURI(AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_NAME, isSecure);
+        builder.serviceName(AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_SERVICE_QNAME);
+        builder.endpointName(AtomicTransactionConstants.COMPLETION_COORDINATOR_RPC_PORT_QNAME);
+        builder.address(address);
+        InstanceIdentifier.setEndpointInstanceIdentifier(builder, instanceIdentifier);
+        return builder.build();
+    }
+
     private W3CEndpointReference getCoordinator(final String participantId, final boolean isSecure)
     {
         W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();

Copied: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/participants/CompletionCoordinatorRPCImple.java (from rev 34619, labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/participants/CompletionCoordinatorImple.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/participants/CompletionCoordinatorRPCImple.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/participants/CompletionCoordinatorRPCImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,155 @@
+package com.arjuna.mwlabs.wst11.at.participants;
+
+import com.arjuna.mw.wsas.activity.ActivityHierarchy;
+import com.arjuna.mw.wscf.model.twophase.api.CoordinatorManager;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorProcessor;
+import com.arjuna.webservices11.wsat.processors.CompletionCoordinatorRPCProcessor;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst11.CompletionCoordinatorParticipant;
+
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: adinn
+ * Date: Oct 30, 2007
+ * Time: 2:37:26 PM
+ * To change this template use File | Settings | File Templates.
+ */
+
+/**
+ *
+ */
+public class CompletionCoordinatorRPCImple implements CompletionCoordinatorParticipant
+{
+    public CompletionCoordinatorRPCImple(CoordinatorManager cm, ActivityHierarchy hier, final boolean deactivate, W3CEndpointReference participant)
+    {
+        _cm = cm;
+        _hier = hier;
+        this.deactivate = deactivate ;
+        this.participant = participant;
+    }
+
+    public void commit () throws TransactionRolledBackException, UnknownTransactionException, SystemException
+    {
+	try
+	{
+	    if (_hier != null)
+		_cm.resume(_hier);
+
+	    _cm.confirm();
+	}
+	catch (com.arjuna.mw.wsas.exceptions.InvalidActivityException ex)
+	{
+	    throw new UnknownTransactionException();
+	}
+	catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wsas.exceptions.ProtocolViolationException ex)
+	{
+	    //	    throw new HeuristicHazardException();
+
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wscf.exceptions.NoCoordinatorException ex)
+	{
+	    throw new UnknownTransactionException();
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorCancelledException ex)
+	{
+	    throw new TransactionRolledBackException();
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.HeuristicMixedException ex)
+	{
+	    //	    throw new HeuristicMixedException();
+
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.HeuristicHazardException ex)
+	{
+	    //	    throw new HeuristicHazardException();
+
+	    throw new SystemException(ex.toString());
+
+	}
+	catch (com.arjuna.mw.wsas.exceptions.NoPermissionException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wsas.exceptions.SystemException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	finally
+	{
+	    if (deactivate)
+	        CompletionCoordinatorRPCProcessor.getProcessor().deactivateParticipant(this);
+	}
+    }
+
+    public void rollback () throws UnknownTransactionException, SystemException
+    {
+	try
+	{
+	    if (_hier != null)
+		_cm.resume(_hier);
+
+	    _cm.cancel();
+	}
+	catch (com.arjuna.mw.wsas.exceptions.InvalidActivityException ex)
+	{
+	    throw new UnknownTransactionException();
+	}
+	catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wsas.exceptions.ProtocolViolationException ex)
+	{
+	    throw new SystemException();
+	}
+	catch (com.arjuna.mw.wscf.exceptions.NoCoordinatorException ex)
+	{
+	    throw new UnknownTransactionException();
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.CoordinatorConfirmedException ex)
+	{
+	    throw new SystemException();
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.HeuristicMixedException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wscf.model.twophase.exceptions.HeuristicHazardException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wsas.exceptions.NoPermissionException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	catch (com.arjuna.mw.wsas.exceptions.SystemException ex)
+	{
+	    throw new SystemException(ex.toString());
+	}
+	finally
+	{
+        if (deactivate)
+            CompletionCoordinatorRPCProcessor.getProcessor().deactivateParticipant(this);
+	}
+    }
+
+    public W3CEndpointReference getParticipant()
+    {
+        return participant;
+    }
+
+    private CoordinatorManager   _cm;
+    private ActivityHierarchy    _hier;
+    private final boolean deactivate ;
+    private W3CEndpointReference participant;
+}

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/TransactionManagerImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/TransactionManagerImple.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/TransactionManagerImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -116,35 +116,6 @@
 		return _ctxManager.currentTransaction();
 	}
 
-	protected W3CEndpointReference enlistForCompletion (final W3CEndpointReference participantEndpoint)
-			throws WrongStateException, UnknownTransactionException, SystemException
-	{
-		try
-		{
-			TxContextImple currentTx = (TxContextImple) _ctxManager.currentTransaction();
-
-			if (currentTx == null)
-				throw new com.arjuna.wsc.CannotRegisterException();
-
-			return registerParticipant(participantEndpoint, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION);
-		}
-		catch (com.arjuna.wsc.InvalidProtocolException ex)
-		{
-			ex.printStackTrace();
-
-			throw new SystemException(ex.toString());
-		}
-		catch (com.arjuna.wsc.InvalidStateException ex)
-		{
-			throw new WrongStateException();
-		}
-		catch (com.arjuna.wsc.CannotRegisterException ex)
-		{
-            // cause could actually be no activity or already registered
-			throw new UnknownTransactionException();
-		}
-	}
-
     private boolean isCurrentContextSecure()  throws SystemException
     {
         TxContextImple currentTx = (TxContextImple) _ctxManager.currentTransaction();
@@ -154,7 +125,7 @@
         return false;
     }
 
-    private W3CEndpointReference getParticipant(final String id, final boolean isSecure)
+    final W3CEndpointReference getParticipant(final String id, final boolean isSecure)
     {
         final QName serviceName = AtomicTransactionConstants.PARTICIPANT_SERVICE_QNAME;
         final QName endpointName = AtomicTransactionConstants.PARTICIPANT_PORT_QNAME;
@@ -167,7 +138,7 @@
         return builder.build();
     }
 
-	private final W3CEndpointReference registerParticipant (final W3CEndpointReference participant, final String protocol)
+	final W3CEndpointReference registerParticipant (final W3CEndpointReference participant, final String protocol)
 			throws InvalidProtocolException, InvalidStateException, CannotRegisterException, SystemException
 	{
 		TxContextImple currentTx = null;

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -212,10 +212,34 @@
 	{
         TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();
 
-        final TxContextImple txContext = (TxContextImple) tm.currentTransaction();
-        final String id = txContext.identifier();
-        final W3CEndpointReference completionCoordinator = tm.enlistForCompletion(getCompletionParticipant(id, txContext.isSecure()));
+        final TxContextImple currentTx = (TxContextImple) tm.currentTransaction();
+        if (currentTx == null)
+            throw new UnknownTransactionException();
 
+        final String id = currentTx.identifier();
+        final W3CEndpointReference completionParticipant = getCompletionParticipant(id, currentTx.isSecure());
+        W3CEndpointReference completionCoordinator = null;
+
+        try
+        {
+            completionCoordinator = tm.registerParticipant(completionParticipant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION);
+        }
+        catch (com.arjuna.wsc.InvalidProtocolException ex)
+        {
+            ex.printStackTrace();
+
+            throw new SystemException(ex.toString());
+        }
+        catch (com.arjuna.wsc.InvalidStateException ex)
+        {
+            throw new WrongStateException();
+        }
+        catch (com.arjuna.wsc.CannotRegisterException ex)
+        {
+            // cause could actually be no activity or already registered
+            throw new UnknownTransactionException();
+        }
+
         _completionCoordinators.put(id, completionCoordinator);
 	}
 

Copied: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionStandaloneImple.java (from rev 34680, labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionImple.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionStandaloneImple.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/at/remote/UserTransactionStandaloneImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,454 @@
+package com.arjuna.mwlabs.wst11.at.remote;
+
+import com.arjuna.mw.wsc11.context.Context;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.mw.wst11.TransactionManager;
+import com.arjuna.mw.wst11.UserTransaction;
+import com.arjuna.mw.wstx.logging.wstxLogger;
+import com.arjuna.mwlabs.wst.at.remote.ContextManager;
+import com.arjuna.mwlabs.wst11.at.ContextImple;
+import com.arjuna.mwlabs.wst11.at.context.TxContextImple;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
+import com.arjuna.wsc.CannotRegisterException;
+import com.arjuna.wsc.InvalidCreateParametersException;
+import com.arjuna.wsc.InvalidProtocolException;
+import com.arjuna.wsc.InvalidStateException;
+import com.arjuna.wsc11.ActivationCoordinator;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst11.stub.CompletionRPCStub;
+import com.arjuna.wst11.stub.CompletionStub;
+import org.jboss.jbossts.xts.environment.XTSPropertyManager;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import java.util.Hashtable;
+
+/**
+ * An implementation of UserTransaction which employs an RPC MEP based completion protocol specific to
+ * JBoss to complete the transaction. This implementation allows the client to be deployed without the
+ * need to expose any service endpoints.
+ */
+public class UserTransactionStandaloneImple extends UserTransaction
+{
+
+	public UserTransactionStandaloneImple()
+	{
+		try
+		{
+            _activationCoordinatorService = XTSPropertyManager.getWSCEnvironmentBean().getCoordinatorURL11();
+
+			/*
+			 * If the coordinator URL hasn't been specified via the
+			 * configuration file then assume we are using a locally registered
+			 * implementation.
+			 */
+
+			if (_activationCoordinatorService == null)
+			{
+                final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+                _activationCoordinatorService = serviceRegistry.getServiceURI(CoordinationConstants.ACTIVATION_SERVICE_NAME) ;
+			}
+		}
+		catch (Exception ex)
+		{
+			// TODO
+
+			ex.printStackTrace();
+		}
+        // this implementation cannot provide support for subordinate transactions
+        _userSubordinateTransaction = null;
+	}
+
+    public UserTransaction getUserSubordinateTransaction() {
+        return _userSubordinateTransaction;
+    }
+
+    public void begin () throws WrongStateException, SystemException
+    {
+		begin(0);
+	}
+
+	public void begin (int timeout) throws WrongStateException, SystemException
+	{
+		try
+		{
+			if (_ctxManager.currentTransaction() != null)
+				throw new WrongStateException();
+
+			Context ctx = startTransaction(timeout, null);
+
+			_ctxManager.resume(new TxContextImple(ctx));
+
+			enlistCompletionParticipants();
+		}
+		catch (InvalidCreateParametersException ex)
+		{
+			tidyup();
+
+			throw new SystemException(ex.toString());
+		}
+		catch (UnknownTransactionException ex)
+		{
+			tidyup();
+
+			throw new SystemException(ex.toString());
+		}
+		catch (SystemException ex)
+		{
+			tidyup();
+
+			throw ex;
+		}
+	}
+
+	public void commit () throws TransactionRolledBackException,
+            UnknownTransactionException, SecurityException, SystemException, WrongStateException
+	{
+		try
+		{
+			commitWithoutAck();
+		}
+		catch (SystemException ex)
+		{
+			throw ex;
+		}
+		finally
+		{
+			tidyup();
+		}
+	}
+
+	public void rollback () throws UnknownTransactionException, SecurityException, SystemException, WrongStateException
+	{
+		try
+		{
+			abortWithoutAck();
+		}
+		catch (SystemException ex)
+		{
+			throw ex;
+		}
+		finally
+		{
+			tidyup();
+		}
+	}
+
+	public String transactionIdentifier ()
+	{
+		try
+		{
+			return _ctxManager.currentTransaction().toString();
+		}
+		catch (SystemException ex)
+		{
+			return "Unknown";
+		}
+		catch (NullPointerException ex)
+		{
+			return "Unknown";
+		}
+	}
+
+	public String toString ()
+	{
+		return transactionIdentifier();
+	}
+
+    /**
+     * method provided for the benefit of UserSubordinateTransactionImple to allow it
+     * to begin a subordinate transaction which requires an existing context to be
+     * installed on the thread before it will start and instal la new transaction
+     *
+     * @param timeout
+     * @throws com.arjuna.wst.WrongStateException
+     * @throws com.arjuna.wst.SystemException
+     */
+    public void beginSubordinate(int timeout) throws WrongStateException, SystemException
+    {
+        throw new SystemException("UserTransactionStandaloneImple does not support subordinate transactions");
+    }
+
+	/*
+	 * enlist the client for the completiopn protocol so it can commit or ro0ll back the transaction
+	 */
+
+	private final void enlistCompletionParticipants ()
+			throws WrongStateException, UnknownTransactionException,
+			SystemException
+	{
+        TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();
+
+        final TxContextImple currentTx = (TxContextImple) tm.currentTransaction();
+        if (currentTx == null)
+            throw new UnknownTransactionException();
+
+        final String id = currentTx.identifier();
+        W3CEndpointReference completionCoordinator = null;
+
+        try
+        {
+            completionCoordinator = tm.registerParticipant(null, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION_RPC);
+        }
+        catch (InvalidProtocolException ex)
+        {
+            ex.printStackTrace();
+
+            throw new SystemException(ex.toString());
+        }
+        catch (InvalidStateException ex)
+        {
+            throw new WrongStateException();
+        }
+        catch (CannotRegisterException ex)
+        {
+            // cause could actually be no activity or already registered
+            throw new UnknownTransactionException();
+        }
+
+        _completionCoordinators.put(id, completionCoordinator);
+	}
+
+    /**
+     * fetch the coordination context type stashed in the current AT context implememtation
+     * and use it to construct an instance of the coordination context extension type we need to
+     * send down the wire to the activation coordinator
+     * @param current the current AT context implememtation
+     * @return an instance of the coordination context extension type
+     */
+    private CoordinationContext getContext(TxContextImple current)
+    {
+        CoordinationContextType contextType = getContextType(current);
+        CoordinationContext context = new CoordinationContext();
+        context.setCoordinationType(contextType.getCoordinationType());
+        context.setExpires(contextType.getExpires());
+        context.setIdentifier(contextType.getIdentifier());
+        context.setRegistrationService(contextType.getRegistrationService());
+
+        return context;
+    }
+
+    /**
+     * fetch the coordination context type stashed in the current AT context implememtation
+     * @param current the current AT context implememtation
+     * @return the coordination context type stashed in the current AT context implememtation
+     */
+    private CoordinationContextType getContextType(TxContextImple current)
+    {
+        ContextImple contextImple = (ContextImple)current.context();
+        return contextImple.getCoordinationContext();
+    }
+
+    protected final Context startTransaction(int timeout, TxContextImple current)
+			throws InvalidCreateParametersException,
+			SystemException
+	{
+		try
+		{
+            // TODO: tricks for per app _activationCoordinatorService config, perhaps:
+            //InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("/foo.properties");
+
+
+            final Long expires = (timeout > 0 ? new Long(timeout) : null) ;
+            final String messageId = MessageId.getMessageId() ;
+            final CoordinationContext currentContext = (current != null ? getContext(current) : null);
+            final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(
+                    _activationCoordinatorService, messageId, AtomicTransactionConstants.WSAT_PROTOCOL, expires, currentContext) ;
+            if (coordinationContext == null)
+            {
+                throw new SystemException(
+                        wstxLogger.i18NLogger.get_mwlabs_wst_at_remote_UserTransaction11Imple__2());
+            }
+            return new ContextImple(coordinationContext) ;
+		}
+        catch (final InvalidCreateParametersException icpe)
+        {
+            throw icpe ;
+        }
+		catch (final SoapFault sf)
+		{
+			throw new SystemException(sf.getMessage()) ;
+		}
+		catch (final Exception ex)
+		{
+			throw new SystemException(ex.toString());
+		}
+	}
+
+	private final void commitWithoutAck ()
+			throws TransactionRolledBackException, UnknownTransactionException,
+			SecurityException, SystemException, WrongStateException
+	{
+		TxContextImple ctx = null;
+		String id = null;
+
+		try
+		{
+			ctx = (TxContextImple) _ctxManager.suspend();
+            if (ctx == null) {
+                throw new WrongStateException();
+            }
+			id = ctx.identifier();
+
+			/*
+			 * By default the completionParticipantURL won't be set for an interposed (imported)
+			 * bridged transaction. This is fine, because you shouldn't be able to commit that
+			 * transaction from a node in the tree, only from the root. So, we can prevent commit
+			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
+			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
+			 * for how to do this).
+			 *
+			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
+			 */
+
+			final W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
+
+			if (completionCoordinator == null)
+				throw new WrongStateException();
+
+			CompletionRPCStub completionStub = new CompletionRPCStub(id, completionCoordinator);
+
+			completionStub.commit();
+		}
+		catch (SystemException ex)
+		{
+			throw ex;
+		}
+		catch (TransactionRolledBackException ex)
+		{
+			throw ex;
+		}
+		catch (UnknownTransactionException ex)
+		{
+			throw ex;
+		}
+		catch (SecurityException ex)
+		{
+			throw ex;
+		}
+        catch (WrongStateException ex)
+        {
+            throw ex;
+        }
+		catch (Exception ex)
+		{
+			ex.printStackTrace();
+
+			throw new SystemException(ex.toString());
+		}
+		finally
+		{
+			try
+			{
+				if (ctx != null)
+					_ctxManager.resume(ctx);
+			}
+			catch (Exception ex)
+			{
+				ex.printStackTrace();
+			}
+
+			if (id != null)
+				_completionCoordinators.remove(id);
+		}
+	}
+
+	private final void abortWithoutAck () throws UnknownTransactionException, SecurityException,
+			SystemException, WrongStateException
+	{
+		TxContextImple ctx = null;
+		String id = null;
+
+		try
+		{
+			ctx = (TxContextImple) _ctxManager.suspend();
+            if (ctx == null) {
+                throw new WrongStateException();
+            }
+			id = ctx.identifier();
+
+			/*
+			 * By default the completionParticipantURL won't be set for an interposed (imported)
+			 * bridged transaction. This is fine, because you shouldn't be able to commit that
+			 * transaction from a node in the tree, only from the root. So, we can prevent commit
+			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
+			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
+			 * for how to do this).
+			 *
+			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
+			 */
+
+			W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
+
+			if (completionCoordinator == null)
+				throw new WrongStateException();
+
+			CompletionRPCStub completionStub = new CompletionRPCStub(id, completionCoordinator);
+
+			completionStub.rollback();
+		}
+		catch (SystemException ex)
+		{
+			throw ex;
+		}
+		catch (UnknownTransactionException ex)
+		{
+			throw ex;
+		}
+		catch (SecurityException ex)
+		{
+			throw ex;
+		}
+        catch (WrongStateException ex)
+        {
+            throw ex;
+        }
+		catch (Exception ex)
+		{
+			throw new SystemException(ex.toString());
+		}
+		finally
+		{
+			try
+			{
+				if (ctx != null)
+					_ctxManager.resume(ctx);
+			}
+			catch (Exception ex)
+			{
+				ex.printStackTrace();
+			}
+
+			if (id != null)
+				_completionCoordinators.remove(id);
+		}
+	}
+
+	protected final void tidyup ()
+	{
+		try
+		{
+			_ctxManager.suspend();
+		}
+		catch (Exception ex)
+		{
+			ex.printStackTrace();
+		}
+	}
+
+	protected ContextManager _ctxManager = new ContextManager();
+	protected String _activationCoordinatorService;
+	private Hashtable _completionCoordinators = new Hashtable();
+    private UserSubordinateTransactionImple _userSubordinateTransaction;
+}

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/ContextFactoryImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/ContextFactoryImple.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/ContextFactoryImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -168,6 +168,10 @@
             final W3CEndpointReference registrationCoordinator = getRegistrationCoordinator(registrationCoordinatorURI, arjunaContext);
             coordinationContext.setRegistrationService(registrationCoordinator) ;
 
+                // why is this created early even though the enlistment for termination
+                // is done late? well that's a good question. look at the corresponding registrar
+                // code to see why
+                // TODO sort this out
             String transactionIdentifier = arjunaContext.getTransactionIdentifier();
             BusinessActivityTerminator terminator = new BusinessActivityTerminatorImple();
             TerminationCoordinatorProcessor.getProcessor().activateParticipant(terminator, transactionIdentifier);

Modified: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/RegistrarImple.java
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/RegistrarImple.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/RegistrarImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -45,6 +45,7 @@
 import com.arjuna.mwlabs.wst11.ba.remote.SubordinateBAParticipantManagerImple;
 import com.arjuna.mwlabs.wscf.model.sagas.arjunacore.BACoordinator;
 import com.arjuna.mwlabs.wscf.model.sagas.arjunacore.subordinate.SubordinateBACoordinator;
+import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorRPCProcessor;
 import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
@@ -78,7 +79,8 @@
 			BusinessActivityConstants.WSBA_SUB_PROTOCOL_PARTICIPANT_COMPLETION, this);
 		mapper.addRegistrar(
 			BusinessActivityConstants.WSBA_SUB_PROTOCOL_COORDINATOR_COMPLETION, this);
-		mapper.addRegistrar(com.arjuna.webservices.wsarjtx.ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION, this);
+        mapper.addRegistrar(com.arjuna.webservices.wsarjtx.ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION, this);
+        mapper.addRegistrar(com.arjuna.webservices.wsarjtx.ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION_RPC, this);
 	}
 
 	/**
@@ -228,6 +230,37 @@
 						throw new InvalidStateException();
 					}
 				}
+                else
+                    if (com.arjuna.webservices.wsarjtx.ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION_RPC.equals(protocolIdentifier))
+                    {
+                        /*
+                         * there is no end point ot update here so there is no need to look up the terminator
+                         *
+                         * this is a hack because the terminator has already been created at context create. this allows the
+                         * enlist to be delayed until close/cancel and just return the end point with the requisite instance
+                         * identifier. unfortunately this also means that you have to register in order to complete but not
+                         * remove the terminator.
+                         * 
+                         * TODO sort this out
+                         */
+                        /*
+                        BusinessActivityTerminatorImple terminator;
+                        terminator = (BusinessActivityTerminatorImple) TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier);
+                        */
+
+                        try
+                        {
+                            return getParticipantManager(
+                                    ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_QNAME,
+                                    ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_PORT_QNAME,
+                                    ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_COORDINATOR_RPC_SERVICE_NAME, isSecure),
+                                    instanceIdentifier.getInstanceIdentifier());
+                        }
+                        catch (Exception ex)
+                        {
+                            throw new InvalidStateException();
+                        }
+                    }
 				else {
                     wstxLogger.i18NLogger.warn_mwlabs_wst_ba_Registrar11Imple_1(BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, protocolIdentifier);
 

Copied: labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityStandaloneImple.java (from rev 34680, labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityImple.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityStandaloneImple.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WSTX/classes11/com/arjuna/mwlabs/wst11/ba/remote/UserBusinessActivityStandaloneImple.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -0,0 +1,378 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. 
+ * See the copyright.txt in the distribution for a full listing 
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+/*
+ * Copyright (C) 2003,
+ *
+ * Arjuna Technologies Limited,
+ * Newcastle upon Tyne,
+ * Tyne and Wear,
+ * UK.
+ *
+ * $Id: UserBusinessActivityImple.java,v 1.10.4.1 2005/11/22 10:36:07 kconner Exp $
+ */
+
+package com.arjuna.mwlabs.wst11.ba.remote;
+
+import com.arjuna.mw.wsc11.context.Context;
+import com.arjuna.mw.wst.TxContext;
+import com.arjuna.mw.wst11.UserBusinessActivity;
+import com.arjuna.mw.wstx.logging.wstxLogger;
+import com.arjuna.mwlabs.wst.ba.remote.ContextManager;
+import com.arjuna.mwlabs.wst11.ba.ContextImple;
+import com.arjuna.mwlabs.wst11.ba.context.TxContextImple;
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
+import com.arjuna.wsc.InvalidCreateParametersException;
+import com.arjuna.wsc11.ActivationCoordinator;
+import com.arjuna.wsc11.RegistrationCoordinator;
+import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.wst.SystemException;
+import com.arjuna.wst.TransactionRolledBackException;
+import com.arjuna.wst.UnknownTransactionException;
+import com.arjuna.wst.WrongStateException;
+import com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub;
+import com.arjuna.wst11.stub.BusinessActivityTerminatorStub;
+import org.jboss.jbossts.xts.environment.XTSPropertyManager;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext;
+import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+
+/**
+ * This is the interface that allows transactions to be started and terminated.
+ * The messaging layer converts the Commit, Rollback and Notify messages into
+ * calls on this.
+ *
+ */
+
+public class UserBusinessActivityStandaloneImple extends UserBusinessActivity
+{
+    public UserBusinessActivityStandaloneImple()
+    {
+        try
+        {
+            _activationCoordinatorService = XTSPropertyManager.getWSCEnvironmentBean().getCoordinatorURL11();
+
+            /*
+             * If the coordinator URL hasn't been specified via the
+             * configuration file then assume we are using a locally registered
+             * implementation.
+             */
+
+            if (_activationCoordinatorService == null)
+            {
+                final ServiceRegistry serviceRegistry = ServiceRegistry.getRegistry() ;
+                _activationCoordinatorService = serviceRegistry.getServiceURI(CoordinationConstants.ACTIVATION_SERVICE_NAME) ;
+            }
+        }
+        catch (Exception ex)
+        {
+            // TODO
+
+            ex.printStackTrace();
+        }
+    }
+
+    public UserBusinessActivity getUserSubordinateBusinessActivity() {
+        return null;
+    }
+
+    public void begin () throws WrongStateException, SystemException
+    {
+    	begin(0);
+    }
+
+    public void begin (int timeout) throws WrongStateException, SystemException
+    {
+    	try
+    	{
+    	    if (_ctxManager.currentTransaction() != null)
+        		throw new WrongStateException();
+
+    	    Context ctx = startTransaction(timeout, null);
+
+    	    _ctxManager.resume(new TxContextImple(ctx));
+    	}
+    	catch (InvalidCreateParametersException ex)
+    	{
+    	    tidyup();
+
+    	    throw new SystemException(ex.toString());
+    	}
+    	catch (UnknownTransactionException ex)
+    	{
+    	    tidyup();
+
+    	    throw new SystemException(ex.toString());
+    	}
+    	catch (SystemException ex)
+    	{
+    	    tidyup();
+
+    	    throw ex;
+    	}
+    }
+
+    public void close () throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException
+    {
+    	TxContextImple ctx = null;
+
+    	try
+    	{
+    	    ctx = (TxContextImple) _ctxManager.suspend();
+            if (ctx == null) {
+                throw new WrongStateException();
+            }
+
+            final String id = ctx.identifier() ;
+            final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx) ;
+
+    	    BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
+
+    	    terminatorRPCStub.close();
+    	}
+    	catch (SystemException ex)
+    	{
+    	    throw ex;
+    	}
+    	catch (TransactionRolledBackException ex)
+    	{
+    	    throw ex;
+    	}
+        catch (WrongStateException ex)
+        {
+            throw ex;
+        }
+    	catch (UnknownTransactionException ex)
+    	{
+    	    throw ex;
+    	}
+    	catch (Exception ex)
+    	{
+    	    ex.printStackTrace();
+
+    	    throw new SystemException(ex.toString());
+    	}
+    	finally
+    	{
+    	    tidyup();
+    	}
+    }
+
+    public void cancel () throws UnknownTransactionException, SystemException, WrongStateException
+    {
+    	TxContextImple ctx = null;
+
+    	try
+    	{
+            ctx = (TxContextImple) _ctxManager.suspend();
+            if (ctx == null) {
+                throw new WrongStateException();
+            }
+
+            final String id = ctx.identifier() ;
+            final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx) ;
+
+            BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
+
+    	    terminatorRPCStub.cancel();
+    	}
+    	catch (SystemException ex)
+    	{
+    	    throw ex;
+    	}
+        catch (WrongStateException ex)
+        {
+            throw ex;
+        }
+    	catch (UnknownTransactionException ex)
+    	{
+    	    throw ex;
+    	}
+    	catch (Exception ex)
+    	{
+    	    ex.printStackTrace();
+
+    	    throw new SystemException(ex.toString());
+    	}
+    	finally
+    	{
+    	    tidyup();
+    	}
+    }
+
+    public void complete () throws UnknownTransactionException, SystemException, WrongStateException
+    {
+    	try
+    	{
+            final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction()) ;
+            if (ctx == null) {
+                throw new WrongStateException();
+            }
+            final String id = ctx.identifier() ;
+            final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx) ;
+
+            BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
+
+    	    terminatorRPCStub.complete();
+    	}
+    	catch (SystemException ex)
+    	{
+    	    throw ex;
+    	}
+    	catch (UnknownTransactionException ex)
+    	{
+    	    throw ex;
+    	}
+        catch (WrongStateException ex)
+        {
+            throw ex;
+        }
+    	catch (Exception ex)
+    	{
+    	    throw new SystemException(ex.toString());
+    	}
+    }
+
+    public String transactionIdentifier ()
+    {
+    	try
+    	{
+    	    return _ctxManager.currentTransaction().toString();
+    	}
+    	catch (SystemException ex)
+    	{
+    	    return "Unknown";
+    	}
+    	catch (NullPointerException ex)
+    	{
+    	    return "Unknown";
+    	}
+    }
+
+    public String toString ()
+    {
+    	return transactionIdentifier();
+    }
+
+    public void beginSubordinate(int timeout) throws WrongStateException, SystemException
+    {
+        throw new SystemException("UserBusinessActivityStandaloneImple does not support subordinate transactions");
+    }
+
+    /**
+     * fetch the coordination context type stashed in the current BA context implememtation
+     * and use it to construct an instance of the coordination context extension type we need to
+     * send down the wire to the activation coordinator
+     * @param current the current AT context implememtation
+     * @return an instance of the coordination context extension type
+     */
+    private CoordinationContext getContext(TxContextImple current)
+    {
+        CoordinationContextType contextType = getContextType(current);
+        CoordinationContext context = new CoordinationContext();
+        context.setCoordinationType(contextType.getCoordinationType());
+        context.setExpires(contextType.getExpires());
+        context.setIdentifier(contextType.getIdentifier());
+        context.setRegistrationService(contextType.getRegistrationService());
+
+        return context;
+    }
+
+    /**
+     * fetch the coordination context type stashed in the current BA context implememtation
+     * @param current the current AT context implememtation
+     * @return the coordination context type stashed in the current AT context implememtation
+     */
+    private CoordinationContextType getContextType(TxContextImple current)
+    {
+        ContextImple contextImple = (ContextImple)current.context();
+        return contextImple.getCoordinationContext();
+    }
+
+    private final Context startTransaction (int timeout, TxContextImple current) throws InvalidCreateParametersException, SystemException
+    {
+        try
+        {
+            final Long expires = (timeout > 0 ? new Long(timeout) : null) ;
+            final String messageId = MessageId.getMessageId() ;
+            final CoordinationContext currentContext = (current != null ? getContext(current) : null);
+            final CoordinationContextType coordinationContext = ActivationCoordinator.createCoordinationContext(
+                    _activationCoordinatorService, messageId, BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, expires, currentContext) ;
+            if (coordinationContext == null)
+            {
+                throw new SystemException(
+                        wstxLogger.i18NLogger.get_mwlabs_wst11_ba_remote_UserBusinessActivityImple_2());
+            }
+            return new ContextImple(coordinationContext) ;
+        }
+        catch (final InvalidCreateParametersException icpe)
+        {
+            throw icpe ;
+        }
+        catch (final SoapFault sf)
+        {
+            throw new SystemException(sf.getMessage()) ;
+        }
+        catch (final Exception ex)
+        {
+            throw new SystemException(ex.toString());
+        }
+	}
+
+    private W3CEndpointReference getTerminationCoordinatorRPC(final TxContextImple ctx)
+        throws SystemException
+    {
+        final CoordinationContextType coordinationContext = ctx.context().getCoordinationContext() ;
+        final String messageId = MessageId.getMessageId() ;
+        try
+        {
+            return RegistrationCoordinator.register(coordinationContext, messageId, null, ArjunaTXConstants.WSARJTX_PROTOCOL_TERMINATION_RPC) ;
+        }
+        catch (final Throwable th)
+        {
+            throw new SystemException(wstxLogger.i18NLogger.get_mwlabs_wst11_ba_remote_UserBusinessActivityImple_3());
+        }
+    }
+
+    private final void tidyup ()
+    {
+    	try
+    	{
+    	    _ctxManager.suspend();
+    	}
+    	catch (Exception ex)
+    	{
+    	    ex.printStackTrace();
+    	}
+    }
+
+    private ContextManager _ctxManager = new ContextManager();
+    private String _activationCoordinatorService;
+    private UserSubordinateBusinessActivityImple _userSubordinateBusinessActivity;
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/config/xts-properties.xml
===================================================================
--- labs/jbosstm/trunk/XTS/config/xts-properties.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/config/xts-properties.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -151,6 +151,10 @@
 	not need to operate as a client or web service
 	then you can leave these properties unset and the corresponding
 	classes will  not be loaded.
+	
+	Note that in the client container you must define both the UserXX and XXManager classes.
+	In the participant container you do not have to define the UserXXX class unless you also
+	want it to operate as a client container
     -->
     <!--  client mappings for the 1.1 implementation
     -->

Modified: labs/jbosstm/trunk/XTS/config/xts-properties11.xml
===================================================================
--- labs/jbosstm/trunk/XTS/config/xts-properties11.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/config/xts-properties11.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -132,6 +132,10 @@
 	not need to operate as a client or web service
 	then you can leave these properties unset and the corresponding
 	classes will  not be loaded.
+
+	Note that in the client container you must define both the UserXX and XXManager classes.
+	In the participant container you do not have to define the UserXXX class unless you also
+	want it to operate as a client container
     -->
     <!--  client mappings for the 1.1 implementation
     -->

Modified: labs/jbosstm/trunk/XTS/sar/META-INF/xts-jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/META-INF/xts-jboss-beans.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/sar/META-INF/xts-jboss-beans.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -211,6 +211,10 @@
         The WST environment properties are used to identify and load the classes which implement the
         WSAT and WSBA client and web service APIs. They need only be specified in a container which will
         be running XTS clients or web services.
+
+	    Note that in the client container you must define both the UserXX and XXManager classes.
+	    In the participant container you do not have to define the UserXXX class unless you also
+	    want it to operate as a client container
     -->
     <bean name="XTS:WSTEnvironmentBean" class="org.jboss.jbossts.xts.environment.WSTEnvironmentBean">
         <constructor factoryClass="org.jboss.jbossts.xts.environment.XTSPropertyManager"

Modified: labs/jbosstm/trunk/XTS/sar/META-INF/xts11-jboss-beans.xml
===================================================================
--- labs/jbosstm/trunk/XTS/sar/META-INF/xts11-jboss-beans.xml	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/sar/META-INF/xts11-jboss-beans.xml	2010-09-01 14:09:52 UTC (rev 34953)
@@ -168,6 +168,10 @@
         The WST environment properties are used to identify and load the classes which implement the
         WSAT and WSBA client and web service APIs. They need only be specified in a container which will
         be running XTS clients or web services.
+
+	    Note that in the client container you must define both the UserXX and XXManager classes.
+	    In the participant container you do not have to define the UserXXX class unless you also
+	    want it to operate as a client container
     -->
     <bean name="XTS:WSTEnvironmentBean" class="org.jboss.jbossts.xts.environment.WSTEnvironmentBean">
         <constructor factoryClass="org.jboss.jbossts.xts.environment.XTSPropertyManager"

Modified: labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/initialisation/CoordinatorSideInitialisation.java
===================================================================
--- labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/initialisation/CoordinatorSideInitialisation.java	2010-09-01 13:30:19 UTC (rev 34952)
+++ labs/jbosstm/trunk/XTS/sar/src/org/jboss/jbossts/xts/initialisation/CoordinatorSideInitialisation.java	2010-09-01 14:09:52 UTC (rev 34953)
@@ -2,7 +2,9 @@
 
 import com.arjuna.mw.wsc11.deploy.WSCFInitialisation;
 import com.arjuna.webservices11.wsarjtx.server.TerminationCoordinatorInitialisation;
+import com.arjuna.webservices11.wsarjtx.server.TerminationCoordinatorRPCInitialisation;
 import com.arjuna.webservices11.wsat.server.CompletionCoordinatorInitialisation;
+import com.arjuna.webservices11.wsat.server.CompletionCoordinatorRPCInitialisation;
 import com.arjuna.webservices11.wsat.server.CoordinatorInitialisation;
 import com.arjuna.webservices11.wsba.server.CoordinatorCompletionCoordinatorInitialisation;
 import com.arjuna.webservices11.wsba.server.ParticipantCompletionCoordinatorInitialisation;
@@ -29,10 +31,12 @@
 
         CoordinatorInitialisation.startup();
         CompletionCoordinatorInitialisation.startup();
+        CompletionCoordinatorRPCInitialisation.startup();
 
         CoordinatorCompletionCoordinatorInitialisation.startup();
         ParticipantCompletionCoordinatorInitialisation.startup();
         TerminationCoordinatorInitialisation.startup();
+        TerminationCoordinatorRPCInitialisation.startup();
 
         WSTCoordinatorInitialisation.startup();
 
@@ -63,6 +67,7 @@
 
         WSTCoordinatorInitialisation.shutdown();
 
+        TerminationCoordinatorRPCInitialisation.shutdown();
         TerminationCoordinatorInitialisation.shutdown();
         ParticipantCompletionCoordinatorInitialisation.shutdown();
         CoordinatorCompletionCoordinatorInitialisation.shutdown();



More information about the jboss-svn-commits mailing list