[jboss-svn-commits] JBL Code SVN: r19812 - in labs/jbosstm/trunk/XTS: WS-C/dev/dd and 22 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu May 1 11:40:28 EDT 2008


Author: adinn
Date: 2008-05-01 11:40:27 -0400 (Thu, 01 May 2008)
New Revision: 19812

Added:
   labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/
   labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/build.sh
   labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/wsdl/
   labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/wsdl/soapfault.wsdl
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/client/
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/client/SoapFaultClient.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Body.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Detail.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Envelope.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Fault.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Header.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/ObjectFactory.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultPortType.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultService.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/package-info.java
Modified:
   labs/jbosstm/trunk/XTS/WS-C/build.xml
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/AddressingHelper.java
   labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsarj/InstanceIdentifier.java
   labs/jbosstm/trunk/XTS/WS-T/build.xml
   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/processors/TerminationCoordinatorProcessor.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationCoordinatorPortTypeImpl.java
   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/CompletionInitiatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/ParticipantClient.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/webservices11/wsat/sei/CompletionInitiatorPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CoordinatorPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/ParticipantPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionCoordinatorClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionParticipantClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/WSBAClient.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionCoordinatorPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionParticipantPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionCoordinatorPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionParticipantPortTypeImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java
   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/engines/CoordinatorCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
   labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantEngine.java
   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/CompletionStub.java
Log:
added web methods to all SEIs to handle incoming soap 1.1 faults
added a soap JaxWS SoapFaultClient which can be used to dispatch
an asynchronous soap 1.1 fault message to a service
modified server processors and engines to dispatch soap asynchronous
soap faults to clients as per Kev's 1.1 implementation


Modified: labs/jbosstm/trunk/XTS/WS-C/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/build.xml	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-C/build.xml	2008-05-01 15:40:27 UTC (rev 19812)
@@ -230,6 +230,8 @@
         <mkdir dir="${build.dev.classes11.dir}/org/oasis_open/docs/ws_tx/wscoor/_2006/_06/wsdl"/>
         <copy file="${dev.dd.dir}/wscoor1.1/wsdl/wscoor-activation-binding.wsdl" tofile="${build.dev.classes11.dir}/org/oasis_open/docs/ws_tx/wscoor/_2006/_06/wsdl/wscoor-activation-binding.wsdl"/>
         <copy file="${dev.dd.dir}/wscoor1.1/wsdl/wscoor-registration-binding.wsdl" tofile="${build.dev.classes11.dir}/org/oasis_open/docs/ws_tx/wscoor/_2006/_06/wsdl/wscoor-registration-binding.wsdl"/>
+
+	<copy file="${dev.dd.dir}/soapfault/wsdl/soapfault.wsdl" tofile="${build.dev.classes11.dir}/org/jboss/jbossts/xts/soapfault/wsdl/soapfault.wsdl"/>
         <jar jarfile="${build.dev.lib.dir}/ws-c.jar">
             <fileset dir="${build.dev.classes.dir}"/>
         </jar>

Added: labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/build.sh
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/build.sh	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/build.sh	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,22 @@
+#
+#
+#
+#
+
+if [ ! -d tmp ] ; then
+    mkdir tmp
+fi
+
+if [ ! -d tmp/classes ] ; then
+    mkdir tmp/classes
+fi
+
+if [ ! -d tmp/src ] ; then
+    mkdir tmp/src
+fi
+
+# delete old generated versions -- any changes should be made to a copy!
+
+rm -rf tmp/classes/* tmp/src/*
+
+$GF_HOME/bin/wsimport -verbose -keep -wsdllocation wsdl/soapfault.wsdl -d tmp/classes -s tmp/src -target 2.0 -p org.jboss.jbossts.xts.soapfault wsdl/soapfault.wsdl

Added: labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/wsdl/soapfault.wsdl
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/wsdl/soapfault.wsdl	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/dd/soapfault/wsdl/soapfault.wsdl	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    a specification for a service which can be used to dispatch a SOAP 1.1 SoapFault
+    to an arbitrary client
+-->
+<definitions
+        xmlns:s="http://www.w3.org/2001/XMLSchema"
+        xmlns:tns="http://jbossts.jboss.org/xts/soapfault"
+        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+        xmlns:wsaw="http://www.w3.org/2006/02/addressing/wsdl"
+        targetNamespace="http://jbossts.jboss.org/xts/soapfault"
+    xmlns="http://schemas.xmlsoap.org/wsdl/">
+    <types>
+        <s:schema>
+            <s:import namespace="http://schemas.xmlsoap.org/soap/envelope/"
+                      schemaLocation="http://schemas.xmlsoap.org/soap/envelope"/>
+        </s:schema>
+    </types>
+    <message name="SoapFault">
+         <part name="fault" element="soapenv:Fault" />
+    </message>
+
+    <portType name="SoapFaultPortType">
+        <operation name="SoapFault">
+            <input name="SoapFault" message="tns:SoapFault" />
+        </operation>
+    </portType>
+
+    <binding name="SoapFault_SOAPBinding" type="tns:SoapFaultPortType">
+      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+      <operation name="SoapFault">
+        <input message="tns:Soapfault">
+          <soap:body use="literal"/>
+        </input>
+      </operation>
+    </binding>
+
+    <service name="SoapFaultService">
+      <port binding="tns:SoapFault_SOAPBinding" name="SoapFaultPortType">
+	<wsaw:UsingAddressing required="true"/>
+	<soap:address location="http://localhost:9000/interopat/SoapFaultService"/>
+      </port>
+    </service>
+
+</definitions>

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/SoapFault11.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -2,7 +2,9 @@
 
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.SoapFaultType;
+import com.arjuna.webservices.util.InvalidEnumerationException;
 import org.w3c.dom.Element;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.FactoryConfigurationError;
@@ -132,6 +134,29 @@
          this.headerElements = headerElements ;
      }
 
+    // convert to/from fault we can send via the SoapFaultService
+
+    public Fault toFault()
+    {
+        Fault fault = new Fault();
+        QName faultcode = subcode;
+        String faultstring = getReason();
+        fault.setFaultcode(faultcode);
+        fault.setFaultstring(faultstring);
+        return fault;
+    }
+
+    public static SoapFault11 fromFault(Fault fault)
+    {
+        try {
+            QName subcode = fault.getFaultcode();
+            String reason = fault.getFaultstring();
+            return new SoapFault11(SoapFaultType.FAULT_SENDER, subcode, reason);
+        } catch (Throwable th) {
+            return new SoapFault11(th);
+        }
+    }
+
      /**
       * Get the SOAP fault detailElement.
       * @return The SOAP fault detailElement.

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/AddressingHelper.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/AddressingHelper.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/AddressingHelper.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -1,11 +1,16 @@
 package com.arjuna.webservices11.wsaddr;
 
 import com.arjuna.wsc11.messaging.MessageId;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices.wsarj.ArjunaConstants;
 
 import javax.xml.ws.addressing.*;
 import java.net.URISyntaxException;
 import java.net.URI;
+import java.util.List;
 
+import org.w3c.dom.Element;
+
 /**
  * The complete addressing context.
  * @author kevin
@@ -60,12 +65,52 @@
         // this allows the builder class to be redefined via a property
         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
         final AddressingProperties faultProperties = builder.newAddressingProperties();
+        // ok just calling initializeAsReply directly fails when the ReplyTo/From contain
+        // reference parameter elements. these get installed int the target element extensions
+        // list for insertion into the outgoing message. however, the insertion fails.
+        // JBossWS decides they can be inserted as is without copying because they are SOAP
+        // elements but this ignores the fact that they have a DOM node attached. when the
+        // appendElement is called it barfs because the target and source belogn to different
+        // documents. we patch this by copying the FaultTo or ReplyTo here.
+        patchEndpointReference(addressingProperties);
         faultProperties.initializeAsReply(addressingProperties, true) ;
         faultProperties.setMessageID(makeURI(builder, messageID)) ;
 
         return faultProperties ;
     }
 
+    // patch the case where we have a faulto ro replyto with a single reference parameter which is an
+    // Arjuna TX InstanceIdentifier
+    private static void patchEndpointReference(AddressingProperties addressingProperties) {
+        EndpointReference epr = addressingProperties.getFaultTo();
+        boolean isFaultTo = true;
+        if (epr == null) {
+            epr = addressingProperties.getReplyTo();
+            isFaultTo = false;
+        }
+        if (epr != null) {
+            ReferenceParameters refParams = epr.getReferenceParameters();
+            List<Object> list = refParams.getElements();
+            Object obj;
+            if (list.size() == 1 && ((obj = list.get(0)) instanceof Element)) {
+                Element element = (Element) obj;
+                if (ArjunaConstants.WSARJ_NAMESPACE.equals(element.getNamespaceURI()) &&
+                        ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER.equals(element.getLocalName())) {
+                    String identifier = element.getFirstChild().getNodeValue();
+                    // ok, install a copy of the faultTo/replyTo with a new reference parameter element
+                    AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+                    EndpointReference newEpr = builder.newEndpointReference(epr.getAddress().getURI());
+                    InstanceIdentifier.setEndpointInstanceIdentifier(newEpr, identifier);
+                    if (isFaultTo) {
+                        addressingProperties.setFaultTo(newEpr);
+                    } else {
+                        addressingProperties.setReplyTo(newEpr);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * Create an addressing context that represents a request to the specified address.
      * @param address TheendpointReference target address.
@@ -162,7 +207,7 @@
         requestProperties.setAction(makeURI(builder, ""));
         URI noneURI = URI.create(builder.newAddressingConstants().getNoneURI());
         requestProperties.setReplyTo(builder.newEndpointReference(noneURI));
-        
+
         return requestProperties;
     }
 
@@ -214,6 +259,25 @@
         }
     }
     
+    public static void installFrom(AddressingProperties addressingProperties, EndpointReference epReference, InstanceIdentifier identifier)
+    {
+        AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+        EndpointReference from = builder.newEndpointReference(epReference.getAddress().getURI());
+        InstanceIdentifier.setEndpointInstanceIdentifier(from, identifier);
+        addressingProperties.setFrom(from);
+    }
+
+    public static void installFromReplyTo(AddressingProperties addressingProperties, EndpointReference epReference, InstanceIdentifier identifier)
+    {
+        AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+        EndpointReference from = builder.newEndpointReference(epReference.getAddress().getURI());
+        InstanceIdentifier.setEndpointInstanceIdentifier(from, identifier);
+        EndpointReference replyTo = builder.newEndpointReference(epReference.getAddress().getURI());
+        InstanceIdentifier.setEndpointInstanceIdentifier(replyTo, identifier);
+        addressingProperties.setFrom(from);
+        addressingProperties.setReplyTo(replyTo);
+    }
+
     public static javax.xml.ws.addressing.AttributedURI makeURI(AddressingBuilder builder, String messageID)
     {
         try {

Copied: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/client/SoapFaultClient.java (from rev 19592, labs/jbosstm/trunk/XTS/WS-C/dev/src10/com/arjuna/webservices/wsaddr/client/BaseWSAddrClient.java)
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/client/SoapFaultClient.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsaddr/client/SoapFaultClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,165 @@
+/*
+ * 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 General Public License, v. 2.0.
+ * 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 General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 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.wsaddr.client;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.*;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.handler.Handler;
+
+import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import org.jboss.jbossts.xts.soapfault.SoapFaultPortType;
+import org.jboss.jbossts.xts.soapfault.Fault;
+import org.jboss.jbossts.xts.soapfault.SoapFaultService;
+import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
+import org.w3c.dom.Element;
+
+/**
+ * Base client.
+ * @author kevin
+ */
+public class SoapFaultClient
+{
+    /**
+     * Send a fault.
+     * @param soapFault The SOAP fault.
+     * @param addressingProperties addressing context initialised with to and message ID.
+     * @param action The action URI for the request.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public static void sendSoapFault(final SoapFault11 soapFault,
+                                     final InstanceIdentifier instanceIdentifier,
+                                     final AddressingProperties addressingProperties,
+                                     final AttributedURI action)
+        throws SoapFault11, IOException
+    {
+        if (action != null)
+        {
+            soapFault.setAction(action.getURI().toString()) ;
+        }
+
+        final SoapFaultPortType faultPort = getSoapFaultPort(instanceIdentifier, addressingProperties, action);
+        Fault fault = soapFault.toFault();
+        faultPort.soapFault(fault);
+    }
+
+    /**
+     * Send a fault to a specific endpoint.
+     * @param soapFault The SOAP fault.
+     * @param endpoint an endpoint ot dispatch the fault to.
+     * @param addressingProperties addressing context initialised with to and message ID.
+     * @param action The action URI for the request.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public static void sendSoapFault(final SoapFault11 soapFault,
+                                     W3CEndpointReference endpoint,
+                                     final AddressingProperties addressingProperties,
+                                     final AttributedURI action)
+        throws SoapFault11, IOException
+    {
+        if (action != null)
+        {
+            soapFault.setAction(action.getURI().toString()) ;
+        }
+
+        final SoapFaultPortType faultPort = getSoapFaultPort(endpoint, addressingProperties, action);
+        Fault fault = soapFault.toFault();
+        faultPort.soapFault(fault);
+    }
+
+    /**
+     * fetch a coordinator activation service unique to the current thread
+     * @return
+     */
+    private static synchronized SoapFaultService getSoapFaultService()
+    {
+        if (soapFaultService.get() == null) {
+            soapFaultService.set(new SoapFaultService());
+        }
+        return soapFaultService.get();
+    }
+
+    private static SoapFaultPortType getSoapFaultPort(final InstanceIdentifier instanceIdentifier,
+                                                      final AddressingProperties addressingProperties,
+                                                      final AttributedURI action)
+    {
+        SoapFaultService service = getSoapFaultService();
+        SoapFaultPortType port = service.getPort(SoapFaultPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+        AttributedURI toUri = addressingProperties.getTo();
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+        /*
+         * we have to add the JaxWS WSAddressingClientHandler because we cannot specify the WSAddressing feature
+         */
+		customHandlerChain.add(new WSAddressingClientHandler());
+        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        addressingProperties.setAction(action);
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addressingProperties);
+	    // jbossws should do this for us . . .
+	    requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProperties);
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, toUri.getURI().toString());
+        // need to set soap action header based upon what the client asks for
+        requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, action.getURI().toString());
+
+        return port;
+    }
+
+    private static SoapFaultPortType getSoapFaultPort(final W3CEndpointReference endpoint,
+                                                      final AddressingProperties addressingProperties,
+                                                      final AttributedURI action)
+    {
+        SoapFaultService service = getSoapFaultService();
+        SoapFaultPortType port = service.getPort(endpoint, SoapFaultPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+        addressingProperties.setAction(action);
+        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
+        AttributedURI toUri = requestProperties.getTo();
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+        /*
+         * we have to add the JaxWS WSAddressingClientHandler because we cannot specify the WSAddressing feature
+         */
+		customHandlerChain.add(new WSAddressingClientHandler());
+        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, toUri.getURI().toString());
+        // need to set soap action header based upon what the client asks for
+        requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, action.getURI().toString());
+
+        return port;
+    }
+
+    private static final ThreadLocal<SoapFaultService> soapFaultService = new ThreadLocal<SoapFaultService>();
+}
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsarj/InstanceIdentifier.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsarj/InstanceIdentifier.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/com/arjuna/webservices11/wsarj/InstanceIdentifier.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,6 +27,7 @@
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
+import javax.xml.ws.addressing.EndpointReference;
 
 import com.arjuna.webservices.wsarj.ArjunaConstants;
 
@@ -95,7 +96,7 @@
     }
 
      /**
-     * Set the identifier on an endpoint reference under construction.
+     * Set the identifier on a W3C endpoint reference under construction.
      * @param builder The endpoint reference builder.
      * @param identifier The identifier.
      */
@@ -105,7 +106,7 @@
     }
     
     /**
-     * Set the identifier on an endpoint reference under construction.
+     * Set the identifier on a W3C endpoint reference under construction.
      * @param builder The endpoint reference builder.
      * @param instanceIdentifier The identifier.
      */
@@ -115,6 +116,26 @@
     }
 
     /**
+    * Set the identifier on a WS Addressing endpoint reference under construction.
+    * @param epReference The WS Addressing endpoint reference.
+    * @param instanceIdentifier The identifier.
+    */
+   public static void setEndpointInstanceIdentifier(final EndpointReference epReference, final InstanceIdentifier instanceIdentifier)
+   {
+       setEndpointInstanceIdentifier(epReference, instanceIdentifier.getInstanceIdentifier());
+   }
+
+    /**
+    * Set the identifier on a WS Addressing endpoint reference under construction.
+    * @param epReference The WS Addressing endpoint reference.
+    * @param instanceIdentifier The identifier string.
+    */
+   public static void setEndpointInstanceIdentifier(final EndpointReference epReference, final String instanceIdentifier)
+   {
+       epReference.getReferenceParameters().addElement(createInstanceIdentifierElement(instanceIdentifier));
+   }
+
+    /**
      * a soap factory used to construct SOAPElement instances representing InstanceIdentifier instances
      */
     private static SOAPFactory factory;
@@ -131,7 +152,7 @@
      * suppliedidentifier string as its value
      */
 
-    private static Element createInstanceIdentifierElement(final String instanceIdentifier)
+    public static Element createInstanceIdentifierElement(final String instanceIdentifier)
     {
         try {
             if (factory == null) {
@@ -142,6 +163,7 @@
                 WSARJ_ELEMENT_INSTANCE_NAME = name;
             }
             SOAPElement element = factory.createElement(WSARJ_ELEMENT_INSTANCE_NAME);
+            element.addNamespaceDeclaration(ArjunaConstants.WSARJ_PREFIX, ArjunaConstants.WSARJ_NAMESPACE);
             element.addTextNode(instanceIdentifier);
             return element;
         } catch (SOAPException se) {

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Body.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Body.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Body.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,95 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for Body complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="Body">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;any/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "Body", propOrder = {
+    "any"
+})
+public class Body {
+
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Detail.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Detail.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Detail.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,95 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for detail complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="detail">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;any/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "detail", propOrder = {
+    "any"
+})
+public class Detail {
+
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Envelope.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Envelope.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Envelope.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,152 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for Envelope complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="Envelope">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element ref="{http://schemas.xmlsoap.org/soap/envelope/}Header" minOccurs="0"/>
+ *         &lt;element ref="{http://schemas.xmlsoap.org/soap/envelope/}Body"/>
+ *         &lt;any/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "Envelope", propOrder = {
+    "header",
+    "body",
+    "any"
+})
+public class Envelope {
+
+    @XmlElement(name = "Header", namespace = "http://schemas.xmlsoap.org/soap/envelope/")
+    protected Header header;
+    @XmlElement(name = "Body", namespace = "http://schemas.xmlsoap.org/soap/envelope/", required = true)
+    protected Body body;
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the header property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Header }
+     *     
+     */
+    public Header getHeader() {
+        return header;
+    }
+
+    /**
+     * Sets the value of the header property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Header }
+     *     
+     */
+    public void setHeader(Header value) {
+        this.header = value;
+    }
+
+    /**
+     * Gets the value of the body property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Body }
+     *     
+     */
+    public Body getBody() {
+        return body;
+    }
+
+    /**
+     * Sets the value of the body property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Body }
+     *     
+     */
+    public void setBody(Body value) {
+        this.body = value;
+    }
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Fault.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Fault.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Fault.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,151 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+
+/**
+ * 
+ * 	    Fault reporting structure
+ * 	  
+ * 
+ * <p>Java class for Fault complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="Fault">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="faultcode" type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ *         &lt;element name="faultstring" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element name="faultactor" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ *         &lt;element name="detail" type="{http://schemas.xmlsoap.org/soap/envelope/}detail" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "Fault", propOrder = {
+    "faultcode",
+    "faultstring",
+    "faultactor",
+    "detail"
+})
+public class Fault {
+
+    @XmlElement(required = true)
+    protected QName faultcode;
+    @XmlElement(required = true)
+    protected String faultstring;
+    @XmlSchemaType(name = "anyURI")
+    protected String faultactor;
+    protected Detail detail;
+
+    /**
+     * Gets the value of the faultcode property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link QName }
+     *     
+     */
+    public QName getFaultcode() {
+        return faultcode;
+    }
+
+    /**
+     * Sets the value of the faultcode property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link QName }
+     *     
+     */
+    public void setFaultcode(QName value) {
+        this.faultcode = value;
+    }
+
+    /**
+     * Gets the value of the faultstring property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getFaultstring() {
+        return faultstring;
+    }
+
+    /**
+     * Sets the value of the faultstring property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setFaultstring(String value) {
+        this.faultstring = value;
+    }
+
+    /**
+     * Gets the value of the faultactor property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getFaultactor() {
+        return faultactor;
+    }
+
+    /**
+     * Sets the value of the faultactor property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setFaultactor(String value) {
+        this.faultactor = value;
+    }
+
+    /**
+     * Gets the value of the detail property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link Detail }
+     *     
+     */
+    public Detail getDetail() {
+        return detail;
+    }
+
+    /**
+     * Sets the value of the detail property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link Detail }
+     *     
+     */
+    public void setDetail(Detail value) {
+        this.detail = value;
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Header.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Header.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/Header.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,95 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyAttribute;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+import org.w3c.dom.Element;
+
+
+/**
+ * <p>Java class for Header complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="Header">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;any/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlType(name = "Header", propOrder = {
+    "any"
+})
+public class Header {
+
+    @XmlAnyElement(lax = true)
+    protected List<Object> any;
+    @XmlAnyAttribute
+    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+    /**
+     * Gets the value of the any property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the any property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getAny().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Object }
+     * {@link Element }
+     * 
+     * 
+     */
+    public List<Object> getAny() {
+        if (any == null) {
+            any = new ArrayList<Object>();
+        }
+        return this.any;
+    }
+
+    /**
+     * Gets a map that contains attributes that aren't bound to any typed property on this class.
+     * 
+     * <p>
+     * the map is keyed by the name of the attribute and 
+     * the value is the string value of the attribute.
+     * 
+     * the map returned by this method is live, and you can add new attribute
+     * by updating the map directly. Because of this design, there's no setter.
+     * 
+     * 
+     * @return
+     *     always non-null
+     */
+    public Map<QName, String> getOtherAttributes() {
+        return otherAttributes;
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/ObjectFactory.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/ObjectFactory.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/ObjectFactory.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,115 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the org.jboss.jbossts.xts.soapfault package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+ at XmlRegistry
+public class ObjectFactory {
+
+    private final static QName _Fault_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Fault");
+    private final static QName _Body_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Body");
+    private final static QName _Envelope_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
+    private final static QName _Header_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Header");
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.jbossts.xts.soapfault
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link Detail }
+     * 
+     */
+    public Detail createDetail() {
+        return new Detail();
+    }
+
+    /**
+     * Create an instance of {@link Envelope }
+     * 
+     */
+    public Envelope createEnvelope() {
+        return new Envelope();
+    }
+
+    /**
+     * Create an instance of {@link Header }
+     * 
+     */
+    public Header createHeader() {
+        return new Header();
+    }
+
+    /**
+     * Create an instance of {@link Fault }
+     * 
+     */
+    public Fault createFault() {
+        return new Fault();
+    }
+
+    /**
+     * Create an instance of {@link Body }
+     * 
+     */
+    public Body createBody() {
+        return new Body();
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link Fault }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/soap/envelope/", name = "Fault")
+    public JAXBElement<Fault> createFault(Fault value) {
+        return new JAXBElement<Fault>(_Fault_QNAME, Fault.class, null, value);
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link Body }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/soap/envelope/", name = "Body")
+    public JAXBElement<Body> createBody(Body value) {
+        return new JAXBElement<Body>(_Body_QNAME, Body.class, null, value);
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link Envelope }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/soap/envelope/", name = "Envelope")
+    public JAXBElement<Envelope> createEnvelope(Envelope value) {
+        return new JAXBElement<Envelope>(_Envelope_QNAME, Envelope.class, null, value);
+    }
+
+    /**
+     * Create an instance of {@link JAXBElement }{@code <}{@link Header }{@code >}}
+     * 
+     */
+    @XmlElementDecl(namespace = "http://schemas.xmlsoap.org/soap/envelope/", name = "Header")
+    public JAXBElement<Header> createHeader(Header value) {
+        return new JAXBElement<Header>(_Header_QNAME, Header.class, null, value);
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultPortType.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultPortType.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultPortType.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,32 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.2-hudson-182-RC1
+ * Generated source version: 2.0
+ * 
+ */
+ at WebService(name = "SoapFaultPortType", targetNamespace = "http://jbossts.jboss.org/xts/soapfault")
+ at SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface SoapFaultPortType {
+
+
+    /**
+     * 
+     * @param fault
+     */
+    @WebMethod(operationName = "SoapFault")
+    @Oneway
+    public void soapFault(
+        @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "fault")
+        Fault fault);
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultService.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultService.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/SoapFaultService.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,59 @@
+
+package org.jboss.jbossts.xts.soapfault;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Logger;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.Service21;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.2-hudson-182-RC1
+ * Generated source version: 2.0
+ * 
+ */
+ at WebServiceClient(name = "SoapFaultService", targetNamespace = "http://jbossts.jboss.org/xts/soapfault", wsdlLocation = "wsdl/soapfault.wsdl")
+public class SoapFaultService
+    extends Service21
+{
+
+    private final static URL SOAPFAULTSERVICE_WSDL_LOCATION;
+    private final static Logger logger = Logger.getLogger(org.jboss.jbossts.xts.soapfault.SoapFaultService.class.getName());
+
+    static {
+        URL url = null;
+        try {
+            URL baseUrl;
+            baseUrl = org.jboss.jbossts.xts.soapfault.SoapFaultService.class.getResource(".");
+            url = new URL(baseUrl, "wsdl/soapfault.wsdl");
+        } catch (MalformedURLException e) {
+            logger.warning("Failed to create URL for the wsdl Location: 'wsdl/soapfault.wsdl', retrying as a local file");
+            logger.warning(e.getMessage());
+        }
+        SOAPFAULTSERVICE_WSDL_LOCATION = url;
+    }
+
+    public SoapFaultService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public SoapFaultService() {
+        super(SOAPFAULTSERVICE_WSDL_LOCATION, new QName("http://jbossts.jboss.org/xts/soapfault", "SoapFaultService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns SoapFaultPortType
+     */
+    @WebEndpoint(name = "SoapFaultPortType")
+    public SoapFaultPortType getSoapFaultPortType() {
+        return super.getPort(new QName("http://jbossts.jboss.org/xts/soapfault", "SoapFaultPortType"), SoapFaultPortType.class);
+    }
+
+}

Added: labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/package-info.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/package-info.java	                        (rev 0)
+++ labs/jbosstm/trunk/XTS/WS-C/dev/src11/org/jboss/jbossts/xts/soapfault/package-info.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -0,0 +1,2 @@
+ at javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.xmlsoap.org/soap/envelope/")
+package org.jboss.jbossts.xts.soapfault;

Modified: labs/jbosstm/trunk/XTS/WS-T/build.xml
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/build.xml	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/build.xml	2008-05-01 15:40:27 UTC (rev 19812)
@@ -253,6 +253,7 @@
         <copy file="${dev.dd.dir}/wsarjtx/wsdl/wsarjtx.wsdl" tofile="${build.dev.classes11.dir}/com/arjuna/schemas/ws/_2005/_10/wsarjtx/wsdl/wsarjtx.wsdl"/>
         <copy file="${dev.dd.dir}/wsarjtx/wsdl/wsarjtx-termination-coordinator-binding.wsdl" tofile="${build.dev.classes11.dir}/com/arjuna/schemas/ws/_2005/_10/wsarjtx/wsdl/wsarjtx-termination-coordinator-binding.wsdl"/>
         <copy file="${dev.dd.dir}/wsarjtx/wsdl/wsarjtx-termination-participant-binding.wsdl" tofile="${build.dev.classes11.dir}/com/arjuna/schemas/ws/_2005/_10/wsarjtx/wsdl/wsarjtx-termination-participant-binding.wsdl"/>
+
         <jar jarfile="${build.dev.lib.dir}/ws-t.jar">
             <fileset dir="${build.dev.classes.dir}"/>
             <manifest>

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationCoordinatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -25,13 +25,20 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
 
 import javax.xml.ws.addressing.AddressingBuilder;
 import javax.xml.ws.addressing.AddressingProperties;
 import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URI;
 
 /**
  * The Client side of the Terminator Participant.
@@ -56,8 +63,18 @@
      * The cancel action.
      */
     private AttributedURI cancelAction = null;
+    /**
+     * The SOAP fault action.
+     */
+    private AttributedURI faultAction = null;
 
     /**
+     * The participant URI for replies.
+     */
+    private EndpointReference terminationParticipant ;
+
+
+    /**
      * Construct the terminator participant client.
      */
     private TerminationCoordinatorClient()
@@ -67,6 +84,7 @@
             completeAction = builder.newURI(ArjunaTXConstants.WSARJTX_ACTION_COMPLETE);
             closeAction = builder.newURI(ArjunaTXConstants.WSARJTX_ACTION_CLOSE);
             cancelAction = builder.newURI(ArjunaTXConstants.WSARJTX_ACTION_CANCEL);
+            faultAction = builder.newURI(ArjunaTXConstants.WSARJTX_ACTION_SOAP_FAULT) ;
         } catch (URISyntaxException use) {
             // TODO - log fault and throw exception
         }
@@ -76,6 +94,14 @@
         //AddressingPolicy.register(handlerRegistry) ;
         // Add client policies
         //ClientPolicy.register(handlerRegistry) ;
+        final String terminationParticipantURIString =
+            ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_PARTICIPANT_SERVICE_NAME);
+        try {
+            URI terminationParticipantURI = new URI(terminationParticipantURIString);
+            terminationParticipant = builder.newEndpointReference(terminationParticipantURI);
+        } catch (URISyntaxException use) {
+            // TODO - log fault and throw exception
+        }
     }
 
     /**
@@ -88,6 +114,7 @@
     public void sendComplete(final W3CEndpointReference coordinator, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationParticipant, identifier);
         final TerminationCoordinatorPortType port = getPort(coordinator, addressingProperties, identifier, completeAction);
         final NotificationType complete = new NotificationType();
 
@@ -104,6 +131,7 @@
     public void sendClose(final W3CEndpointReference coordinator, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationParticipant, identifier);
         final TerminationCoordinatorPortType port = getPort(coordinator, addressingProperties, identifier, closeAction);
         final NotificationType close = new NotificationType();
 
@@ -120,6 +148,7 @@
     public void sendCancel(final W3CEndpointReference coordinator, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationParticipant, identifier);
         final TerminationCoordinatorPortType port = getPort(coordinator, addressingProperties, identifier, cancelAction);
         final NotificationType cancel = new NotificationType();
 
@@ -127,6 +156,24 @@
     }
 
     /**
+     * Send a fault.
+     * @param addressingProperties addressing context initialised with to and message ID.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna instance identifier.
+     * @throws SoapFault For any errors.
+     * @throws IOException for any transport errors.
+     */
+    public void sendSoapFault(final W3CEndpointReference endpoint,
+                              final AddressingProperties addressingProperties,
+                              final SoapFault soapFault,
+                              final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        AddressingHelper.installFrom(addressingProperties, terminationParticipant, identifier);
+        // use the SoapFaultService to format a soap fault and send it back to the faultto or from address
+        SoapFaultClient.sendSoapFault((SoapFault11)soapFault, endpoint, addressingProperties, faultAction);
+    }
+    /**
      * Get the Terminator Coordinator client singleton.
      * @return The Terminator Coordinator client singleton.
      */

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/TerminationParticipantClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -26,13 +26,20 @@
 import com.arjuna.webservices.SoapFault;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
 
 import javax.xml.ws.addressing.AddressingBuilder;
 import javax.xml.ws.addressing.AddressingProperties;
 import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.EndpointReference;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 import java.io.IOException;
 import java.net.URISyntaxException;
+import java.net.URI;
 
 /**
  * The Client side of the Terminator Coordinator.
@@ -67,6 +74,11 @@
     private AttributedURI soapFaultAction = null;
 
     /**
+     * The participant URI for replies.
+     */
+    private EndpointReference terminationCoordinator ;
+
+    /**
      * Construct the terminator coordinator client.
      */
     private TerminationParticipantClient()
@@ -87,6 +99,14 @@
         // AddressingPolicy.register(handlerRegistry) ;
         // Add client policies
         // ClientPolicy.register(handlerRegistry) ;
+        final String terminationCoordinatorURIString =
+            ServiceRegistry.getRegistry().getServiceURI(ArjunaTX11Constants.TERMINATION_COORDINATOR_SERVICE_NAME);
+        try {
+            URI terminationCoordinatorURI = new URI(terminationCoordinatorURIString);
+            terminationCoordinator = builder.newEndpointReference(terminationCoordinatorURI);
+        } catch (URISyntaxException use) {
+            // TODO - log fault and throw exception
+        }
     }
 
     /**
@@ -99,6 +119,7 @@
     public void sendCompleted(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationCoordinator, identifier);
         final TerminationParticipantPortType port = getPort(participant, addressingProperties, identifier, completedAction);
         final NotificationType completed = new NotificationType();
 
@@ -115,6 +136,7 @@
     public void sendClosed(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationCoordinator, identifier);
         final TerminationParticipantPortType port = getPort(participant, addressingProperties, identifier, closedAction);
         final NotificationType closed = new NotificationType();
 
@@ -131,6 +153,7 @@
     public void sendCancelled(final W3CEndpointReference participant,final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationCoordinator, identifier);
         final TerminationParticipantPortType port = getPort(participant, addressingProperties, identifier, cancelledAction);
         final NotificationType cancelled = new NotificationType();
 
@@ -147,6 +170,7 @@
     public void sendFaulted(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, terminationCoordinator, identifier);
         final TerminationParticipantPortType port = getPort(participant, addressingProperties, identifier, faultedAction);
         final NotificationType faulted = new NotificationType();
 
@@ -155,6 +179,7 @@
 
     /**
      * Send a fault.
+     * @param participant the endpoint reference for the participant to notify
      * @param addressingProperties The addressing context.
      * @param soapFault The SOAP fault.
      * @param identifier The arjuna  instance identifier.
@@ -164,6 +189,7 @@
     public void sendSoapFault(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final SoapFault soapFault, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, terminationCoordinator, identifier);
         final TerminationParticipantPortType port = getPort(participant, addressingProperties, 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
@@ -177,6 +203,29 @@
     }
 
     /**
+     * Send a fault.
+     * @param addressingProperties The addressing context.
+     * @param soapFault The SOAP fault.
+     * @param identifier The arjuna  instance identifier.
+     * @throws com.arjuna.webservices.SoapFault For any errors.
+     * @throws java.io.IOException for any transport errors.
+     */
+    public void sendSoapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
+        throws SoapFault, IOException
+    {
+        final TerminationParticipantPortType port = getPort(addressingProperties, 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());
+
+        port.faultOperation(fault);
+    }
+
+    /**
      * Get the Terminator Coordinator client singleton.
      * @return The Terminator Coordinator client singleton.
      */
@@ -195,4 +244,12 @@
         // reference as a reference parameter so we don't need that either
         return WSARJTXClient.getTerminationParticipantPort(endpoint, action, addressingProperties);
     }
+
+    private TerminationParticipantPortType getPort(final AddressingProperties addressingProperties,
+                                                   final InstanceIdentifier identifier,
+                                                   final AttributedURI action)
+    {
+        // create a port specific to the incoming addressing properties
+        return WSARJTXClient.getTerminationParticipantPort(identifier, action, addressingProperties);
+    }
 }
\ No newline at end of file

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/client/WSARJTXClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,6 +5,7 @@
 import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantPortType;
 import com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantService;
 import com.arjuna.webservices11.wsarj.handler.InstanceIdentifierHandler;
+import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 
 import javax.xml.ws.BindingProvider;
@@ -21,6 +22,7 @@
 import java.net.URISyntaxException;
 
 import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
+import org.w3c.dom.Element;
 
 /**
  * Created by IntelliJ IDEA.
@@ -136,4 +138,31 @@
         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
         return port;
     }
+    // we use this in situations where we don't have a proper endpoint but we do have caller addressing properties
+    public static TerminationParticipantPortType getTerminationParticipantPort(InstanceIdentifier identifier,
+                                                                               AttributedURI action,
+                                                                               AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        TerminationParticipantService service = getTerminationParticipantService();
+        // TerminationParticipantPortType port = service.getPort(endpointReference, TerminationParticipantPortType.class, new AddressingFeature(true, true));
+        TerminationParticipantPortType port = service.getPort(TerminationParticipantPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+        /*
+         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
+         */
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+		customHandlerChain.add(new WSAddressingClientHandler());
+		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        Element refParam = InstanceIdentifier.createInstanceIdentifierElement(identifier.getInstanceIdentifier());
+        addressingProperties.getReferenceParameters().addElement(refParam);
+        addressingProperties.setAction(action);
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addressingProperties);
+        // JBossWS shoudl do this for us
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProperties);
+        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addressingProperties.getTo().getURI().toString());
+        return port;
+    }
 }
\ No newline at end of file

Modified: 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/TerminationCoordinatorProcessor.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/processors/TerminationCoordinatorProcessor.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -24,6 +24,7 @@
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.wst11.BusinessActivityTerminator;
+import com.arjuna.webservices.SoapFault;
 
 import javax.xml.ws.addressing.AddressingProperties;
 
@@ -105,4 +106,12 @@
      */
     public abstract void complete(final NotificationType complete, final AddressingProperties addressingProperties,
         final ArjunaContext arjunaContext) ;
+
+    /**
+     * handle a soap fault sent by the participant.
+     * @param soapFault The soap fault
+     * @param addressingProperties The addressing context.
+     * @param arjunaContext The arjuna context.
+     */
+    public abstract void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties, final ArjunaContext arjunaContext);
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationCoordinatorPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationCoordinatorPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsarjtx/sei/TerminationCoordinatorPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -7,6 +7,8 @@
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices.SoapFault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
@@ -17,7 +19,9 @@
 import javax.xml.ws.addressing.JAXWSAConstants;
 import javax.xml.ws.handler.MessageContext;
 
+import org.jboss.jbossts.xts.soapfault.Fault;
 
+
 /**
  * This class was generated by the JAX-WS RI.
  * JAX-WS RI 2.1.1-b03-
@@ -107,4 +111,21 @@
         }) ;
     }
 
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                TerminationCoordinatorProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }
\ No newline at end of file

Modified: 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/CompletionCoordinatorClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionCoordinatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,6 +5,7 @@
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.client.WSATClient;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionCoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 
@@ -81,6 +82,7 @@
     public void sendCommit(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, completionInitiator, identifier);
         CompletionCoordinatorPortType port = getPort(endpoint, addressingProperties, commitAction);
         Notification commit = new Notification();
 
@@ -97,6 +99,7 @@
     public void sendRollback(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, completionInitiator, identifier);
         CompletionCoordinatorPortType port = getPort(endpoint, addressingProperties, rollbackAction);
         Notification rollback = new Notification();
                 

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionInitiatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionInitiatorClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CompletionInitiatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,6 +5,9 @@
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.client.WSATClient;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionInitiatorPortType;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 
@@ -86,6 +89,7 @@
     public void sendCommitted(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, completionCoordinator, identifier);
         CompletionInitiatorPortType port = getPort(participant, addressingProperties, committedAction);
         Notification commited = new Notification();
 
@@ -102,6 +106,7 @@
     public void sendAborted(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, completionCoordinator, identifier);
         CompletionInitiatorPortType port = getPort(participant, addressingProperties, abortedAction);
         Notification aborted = new Notification();
 
@@ -119,7 +124,9 @@
     public void sendSoapFault(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final SoapFault soapFault, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
-        // TODO - we only get here if we have no endpoitn so all we can do is log an error!
+        AddressingHelper.installFrom(addressingProperties, completionCoordinator, identifier);
+        // use the SoapFaultService to format a soap fault and send it back to the faultto or from address
+        SoapFaultClient.sendSoapFault((SoapFault11)soapFault, identifier, addressingProperties, faultAction);
     }
 
     /**

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CoordinatorClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/CoordinatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,6 +5,9 @@
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.client.WSATClient;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.CoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 
@@ -96,6 +99,7 @@
     public void sendPrepared(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participant, identifier);
         CoordinatorPortType port = getPort(endpoint, addressingProperties, preparedAction);
         Notification prepared = new Notification();
 
@@ -112,6 +116,7 @@
     public void sendAborted(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participant, identifier);
         CoordinatorPortType port = getPort(endpoint, addressingProperties, abortedAction);
         Notification aborted = new Notification();
 
@@ -128,6 +133,7 @@
     public void sendReadOnly(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participant, identifier);
         CoordinatorPortType port = getPort(endpoint, addressingProperties, readOnlyAction);
         Notification readOnly = new Notification();
 
@@ -144,6 +150,7 @@
     public void sendCommitted(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participant, identifier);
         CoordinatorPortType port = getPort(endpoint, addressingProperties, committedAction);
         Notification committed = new Notification();
 
@@ -161,7 +168,9 @@
     public void sendSoapFault(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final SoapFault soapFault, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
-        // TODO - we cannot do this without an endpoint so all we can do is log a message!
+        AddressingHelper.installFrom(addressingProperties, participant, identifier);
+        // use the SoapFaultService to format a soap fault and send it back to the faultto or from address
+        SoapFaultClient.sendSoapFault((SoapFault11)soapFault, identifier, addressingProperties, faultAction);
     }
 
     /**
@@ -185,7 +194,6 @@
                                                 final AddressingProperties addressingProperties,
                                                 final AttributedURI action)
     {
-        addressingProperties.setFrom(participant);
         return WSATClient.getCoordinatorPort(endpoint, action, addressingProperties);
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/ParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/ParticipantClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/ParticipantClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,6 +5,9 @@
 import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.client.WSATClient;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.ParticipantPortType;
 
@@ -90,6 +93,7 @@
     public void sendPrepare(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinator, identifier);
         ParticipantPortType port = getPort(endpoint, addressingProperties, prepareAction);
         Notification prepare = new Notification();
 
@@ -106,6 +110,7 @@
     public void sendCommit(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinator, identifier);
         ParticipantPortType port = getPort(endpoint, addressingProperties, commitAction);
         Notification commit = new Notification();
 
@@ -122,6 +127,7 @@
     public void sendRollback(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinator, identifier);
         ParticipantPortType port = getPort(endpoint, addressingProperties, rollbackAction);
         Notification rollback = new Notification();
 
@@ -136,10 +142,12 @@
      * @throws com.arjuna.webservices.SoapFault For any errors.
      * @throws java.io.IOException for any transport errors.
      */
-    public void sendSoapFault(final W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final SoapFault soapFault, final InstanceIdentifier identifier)
+    public void sendSoapFault(final AddressingProperties addressingProperties, final SoapFault soapFault, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
-        // TODO - we cannot do this without an ednpoint so all we can do is log an error message!
+        // use the SoapFaultService to format a soap fault and send it back to the faultto or from address
+        AddressingHelper.installFrom(addressingProperties, coordinator, identifier);
+        SoapFaultClient.sendSoapFault((SoapFault11)soapFault, identifier, addressingProperties, faultAction);
     }
 
     /**
@@ -164,6 +172,10 @@
                                                 final AttributedURI action)
     {
         addressingProperties.setFrom(coordinator);
-        return WSATClient.getParticipantPort(participant, action, addressingProperties);
+        if (participant != null) {
+            return WSATClient.getParticipantPort(participant, action, addressingProperties);
+        } else {
+            return WSATClient.getParticipantPort(action, addressingProperties);
+        }
     }
 }

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/client/WSATClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -101,6 +101,8 @@
         return completionInitiatorService.get();
     }
 
+    // fetch ports when we HAVE an endpoint
+
     public static CoordinatorPortType getCoordinatorPort(W3CEndpointReference endpointReference,
                                                          AttributedURI action,
                                                          AddressingProperties addressingProperties)
@@ -110,31 +112,12 @@
         // CoordinatorPortType port = service.getPort(endpointReference, CoordinatorPortType.class, new AddressingFeature(true, true));
         CoordinatorPortType port = service.getPort(endpointReference, CoordinatorPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-       /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
-    // don't think we ever need this as we get a registration port from the endpoint ref returned by
-    // the activation port request
     public static ParticipantPortType getParticipantPort(W3CEndpointReference endpointReference,
                                                          AttributedURI action,
                                                          AddressingProperties addressingProperties)
@@ -144,26 +127,9 @@
         // ParticipantPortType port = service.getPort(endpointReference, ParticipantPortType.class, new AddressingFeature(true, true));
         ParticipantPortType port = service.getPort(endpointReference, ParticipantPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-        /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
@@ -176,26 +142,9 @@
         // CompletionCoordinatorPortType port = service.getPort(endpointReference, CompletionCoordinatorPortType.class, new AddressingFeature(true, true));
         CompletionCoordinatorPortType port = service.getPort(endpointReference, CompletionCoordinatorPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-        /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
@@ -208,12 +157,80 @@
         // CompletionInitiatorPortType port = service.getPort(endpointReference, CompletionInitiatorPortType.class, new AddressingFeature(true, true));
         CompletionInitiatorPortType port = service.getPort(endpointReference, CompletionInitiatorPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
+
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    // fetch ports when we have NO endpoint
+
+    public static CoordinatorPortType getCoordinatorPort(AttributedURI action,
+                                                         AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        CoordinatorService service = getCoordinatorService();
+        // CoordinatorPortType port = service.getPort(CoordinatorPortType.class, new AddressingFeature(true, true));
+        CoordinatorPortType port = service.getPort(CoordinatorPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    public static ParticipantPortType getParticipantPort(AttributedURI action,
+                                                         AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        ParticipantService service = getParticipantService();
+        // ParticipantPortType port = service.getPort(ParticipantPortType.class, new AddressingFeature(true, true));
+        ParticipantPortType port = service.getPort(ParticipantPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    public static CompletionCoordinatorPortType getCompletionCoordinatorPort(AttributedURI action,
+                                                                             AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        CompletionCoordinatorService service = getCompletionCoordinatorService();
+        // CompletionCoordinatorPortType port = service.getPort(CompletionCoordinatorPortType.class, new AddressingFeature(true, true));
+        CompletionCoordinatorPortType port = service.getPort(CompletionCoordinatorPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    public static CompletionInitiatorPortType getCompletionInitiatorPort(AttributedURI action,
+                                                                         AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        CompletionInitiatorService service = getCompletionInitiatorService();
+        // CompletionInitiatorPortType port = service.getPort(CompletionInitiatorPortType.class, new AddressingFeature(true, true));
+        CompletionInitiatorPortType port = service.getPort(CompletionInitiatorPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    private static void configureEndpointPort(BindingProvider bindingProvider,
+                                          AttributedURI action,
+                                          AddressingProperties addressingProperties)
+    {
         /*
          * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
          */
         List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+        customHandlerChain.add(new WSAddressingClientHandler());
+        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
         // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
         // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
         // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
@@ -228,6 +245,24 @@
         AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
         // we should not need to do this but JBossWS does not pick up the value in the addressing properties
         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
-        return port;
     }
+
+    private static void configurePort(BindingProvider bindingProvider,
+                                      AttributedURI action,
+                                      AddressingProperties addressingProperties)
+    {
+        /*
+         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
+         */
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+        customHandlerChain.add(new WSAddressingClientHandler());
+        bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        addressingProperties.setAction(action);
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addressingProperties);
+        // JaxWS should do this for us
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProperties);
+        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addressingProperties.getTo().getURI().toString());
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionInitiatorPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionInitiatorPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CompletionInitiatorPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -2,6 +2,7 @@
 
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionInitiatorPortType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.jws.*;
 import javax.jws.soap.SOAPBinding;
@@ -14,8 +15,10 @@
 
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.services.framework.task.Task;
+import com.arjuna.webservices.SoapFault;
 
 /**
  * This class was generated by the JAX-WS RI.
@@ -83,4 +86,21 @@
         }) ;
     }
 
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                CompletionInitiatorProcessor.getProcessor().handleSoapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CoordinatorPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CoordinatorPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/CoordinatorPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -2,6 +2,7 @@
 
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.CoordinatorPortType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.jws.*;
 import javax.jws.soap.SOAPBinding;
@@ -14,8 +15,10 @@
 
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.services.framework.task.Task;
+import com.arjuna.webservices.SoapFault;
 
 /**
  * This class was generated by the JAX-WS RI.
@@ -129,4 +132,21 @@
         }) ;
     }
 
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                CoordinatorProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/ParticipantPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/ParticipantPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsat/sei/ParticipantPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -2,6 +2,7 @@
 
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.ParticipantPortType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.jws.*;
 import javax.jws.soap.SOAPBinding;
@@ -14,8 +15,10 @@
 
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import com.arjuna.webservices11.SoapFault11;
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.services.framework.task.Task;
+import com.arjuna.webservices.SoapFault;
 
 /**
  * This class was generated by the JAX-WS RI.
@@ -106,4 +109,21 @@
         }) ;
     }
 
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wsat/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                ParticipantProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionCoordinatorClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionCoordinatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -25,6 +25,7 @@
 import com.arjuna.webservices11.wsba.client.WSBAClient;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithCoordinatorCompletionCoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -139,6 +140,7 @@
     public void sendCompleted(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, completedAction);
         NotificationType completed = new NotificationType();
@@ -146,7 +148,7 @@
         port.completedOperation(completed);
     }
 
-    /**
+    /**                                                                 Address
      * Send a fail request.
      * @param addressingProperties addressing context initialised with to and message ID.
      * @param identifier The identifier of the initiator.
@@ -157,6 +159,7 @@
         final QName exceptionIdentifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, failAction);
         ExceptionType fail = new ExceptionType();
@@ -175,6 +178,7 @@
     public void sendCompensated(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, compensatedAction);
         NotificationType compensated = new NotificationType();
@@ -192,6 +196,7 @@
     public void sendClosed(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, closedAction);
         NotificationType closed = new NotificationType();
@@ -209,6 +214,7 @@
     public void sendCancelled(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, cancelledAction);
         NotificationType camcelled = new NotificationType();
@@ -226,6 +232,7 @@
     public void sendExit(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, exitAction);
         NotificationType exited = new NotificationType();
@@ -243,6 +250,7 @@
     public void sendCannotComplete(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, cannotCompleteAction);
         NotificationType cannotComplete = new NotificationType();
@@ -260,6 +268,7 @@
     public void sendGetStatus(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, getStatusAction);
         NotificationType getStatus = new NotificationType();
@@ -278,6 +287,7 @@
         final QName state)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionParticipant, identifier);
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, statusAction);
         StatusType status = new StatusType();
@@ -307,6 +317,10 @@
     getPort(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final AttributedURI action)
     {
         addressingProperties.setFrom(coordinatorCompletionParticipant);
-        return WSBAClient.getCoordinatorCompletionCoordinatorPort(participant, action, addressingProperties);
+        if (participant != null) {
+            return WSBAClient.getCoordinatorCompletionCoordinatorPort(participant, action, addressingProperties);
+        } else {
+            return WSBAClient.getCoordinatorCompletionCoordinatorPort(action, addressingProperties);
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionParticipantClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/CoordinatorCompletionParticipantClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -25,6 +25,7 @@
 import com.arjuna.webservices11.wsba.client.WSBAClient;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithCoordinatorCompletionParticipantPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
@@ -138,6 +139,7 @@
     public void sendComplete(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, completeAction);
         NotificationType complete = new NotificationType();
@@ -155,6 +157,7 @@
     public void sendClose(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, closeAction);
         NotificationType close = new NotificationType();
@@ -172,6 +175,7 @@
     public void sendCancel(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, cancelAction);
         NotificationType cancel = new NotificationType();
@@ -189,6 +193,7 @@
     public void sendCompensate(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, compensateAction);
         NotificationType compensate = new NotificationType();
@@ -206,6 +211,7 @@
     public void sendFailed(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, failedAction);
         NotificationType failed = new NotificationType();
@@ -223,6 +229,7 @@
     public void sendExited(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, exitedAction);
         NotificationType exit = new NotificationType();
@@ -240,6 +247,7 @@
     public void sendNotCompleted(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, notCompletedAction);
         NotificationType notCompleted = new NotificationType();
@@ -257,6 +265,7 @@
     public void sendGetStatus(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, getStatusAction);
         NotificationType getStatus = new NotificationType();
@@ -275,6 +284,7 @@
         final QName state)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, coordinatorCompletionCoordinator, identifier);
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, statusAction);
         StatusType status = new StatusType();
@@ -304,6 +314,10 @@
     getPort(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final AttributedURI action)
     {
         addressingProperties.setFrom(coordinatorCompletionCoordinator);
-        return WSBAClient.getCoordinatorCompletionParticipantPort(participant, action, addressingProperties);
+        if (participant != null) {
+            return WSBAClient.getCoordinatorCompletionParticipantPort(participant, action, addressingProperties);
+        } else {
+            return WSBAClient.getCoordinatorCompletionParticipantPort(action, addressingProperties);
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionCoordinatorClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionCoordinatorClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionCoordinatorClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -25,6 +25,7 @@
 import com.arjuna.webservices11.wsba.client.WSBAClient;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithParticipantCompletionCoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -139,6 +140,7 @@
     public void sendCompleted(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, completedAction);
         NotificationType completed = new NotificationType();
@@ -157,6 +159,7 @@
         final QName exceptionIdentifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, failAction);
         ExceptionType fail = new ExceptionType();
@@ -175,6 +178,7 @@
     public void sendCompensated(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, compensatedAction);
         NotificationType compensated = new NotificationType();
@@ -192,6 +196,7 @@
     public void sendClosed(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, closedAction);
         NotificationType closed = new NotificationType();
@@ -209,6 +214,7 @@
     public void sendCancelled(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, cancelledAction);
         NotificationType cancelled = new NotificationType();
@@ -226,6 +232,7 @@
     public void sendExit(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, exitAction);
         NotificationType exit = new NotificationType();
@@ -243,6 +250,7 @@
     public void sendCannotComplete(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, cannotCompleteAction);
         NotificationType cannotComplete = new NotificationType();
@@ -260,6 +268,7 @@
     public void sendGetStatus(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, getStatusAction);
         NotificationType getStatus = new NotificationType();
@@ -278,6 +287,7 @@
         final QName state)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionParticipant, identifier);
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port;
         port = getPort(endpoint, addressingProperties, statusAction);
         StatusType status = new StatusType();
@@ -307,6 +317,10 @@
     getPort(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final AttributedURI action)
     {
         addressingProperties.setFrom(participantCompletionParticipant);
-        return WSBAClient.getParticipantCompletionCoordinatorPort(participant, action, addressingProperties);
+        if (participant != null) {
+            return WSBAClient.getParticipantCompletionCoordinatorPort(participant, action, addressingProperties);
+        } else {
+            return WSBAClient.getParticipantCompletionCoordinatorPort(action, addressingProperties);
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionParticipantClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionParticipantClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/ParticipantCompletionParticipantClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -25,6 +25,7 @@
 import com.arjuna.webservices11.wsba.client.WSBAClient;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithParticipantCompletionParticipantPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
@@ -133,6 +134,7 @@
     public void sendClose(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, closeAction);
         NotificationType close = new NotificationType();
@@ -150,6 +152,7 @@
     public void sendCancel(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, cancelAction);
         NotificationType cancel = new NotificationType();
@@ -167,6 +170,7 @@
     public void sendCompensate(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, compensateAction);
         NotificationType compensate = new NotificationType();
@@ -184,6 +188,7 @@
     public void sendFailed(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, failedAction);
         NotificationType failed = new NotificationType();
@@ -201,6 +206,7 @@
     public void sendExited(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, exitedAction);
         NotificationType exited = new NotificationType();
@@ -218,6 +224,7 @@
     public void sendNotCompleted(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFrom(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, notCompletedAction);
         NotificationType notCompleted = new NotificationType();
@@ -235,6 +242,7 @@
     public void sendGetStatus(W3CEndpointReference endpoint, final AddressingProperties addressingProperties, final InstanceIdentifier identifier)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, getStatusAction);
         NotificationType getStatus = new NotificationType();
@@ -253,6 +261,7 @@
         final QName state)
         throws SoapFault, IOException
     {
+        AddressingHelper.installFromReplyTo(addressingProperties, participantCompletionCoordinator, identifier);
         BusinessAgreementWithParticipantCompletionParticipantPortType port;
         port = getPort(endpoint, addressingProperties, statusAction);
         StatusType status = new StatusType();
@@ -282,6 +291,10 @@
     getPort(final W3CEndpointReference participant, final AddressingProperties addressingProperties, final AttributedURI action)
     {
         addressingProperties.setFrom(participantCompletionCoordinator);
-        return WSBAClient.getParticipantCompletionParticipantPort(participant, action, addressingProperties);
+        if (participant != null) {
+            return WSBAClient.getParticipantCompletionParticipantPort(participant, action, addressingProperties);
+        } else {
+            return WSBAClient.getParticipantCompletionParticipantPort(action, addressingProperties);
+        }
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/WSBAClient.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/WSBAClient.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/client/WSBAClient.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -98,6 +98,8 @@
         return coordinatorCompletionParticipantService.get();
     }
 
+    // get ports where we HAVE an endpoint to create the port from
+
     public static BusinessAgreementWithParticipantCompletionCoordinatorPortType getParticipantCompletionCoordinatorPort(W3CEndpointReference endpointReference,
                                                          AttributedURI action,
                                                          AddressingProperties addressingProperties)
@@ -107,31 +109,12 @@
         // BusinessAgreementWithParticipantCompletionCoordinatorPortType port = service.getPort(endpointReference, BusinessAgreementWithParticipantCompletionCoordinatorPortType.class, new AddressingFeature(true, true));
         BusinessAgreementWithParticipantCompletionCoordinatorPortType port = service.getPort(endpointReference, BusinessAgreementWithParticipantCompletionCoordinatorPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-        /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
-    // don't think we ever need this as we get a registration port from the endpoint ref returned by
-    // the activation port request
     public static BusinessAgreementWithParticipantCompletionParticipantPortType getParticipantCompletionParticipantPort(W3CEndpointReference endpointReference,
                                                          AttributedURI action,
                                                          AddressingProperties addressingProperties)
@@ -141,26 +124,9 @@
         // BusinessAgreementWithParticipantCompletionParticipantPortType port = service.getPort(endpointReference, BusinessAgreementWithParticipantCompletionParticipantPortType.class, new AddressingFeature(true, true));
         BusinessAgreementWithParticipantCompletionParticipantPortType port = service.getPort(endpointReference, BusinessAgreementWithParticipantCompletionParticipantPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-        /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
@@ -173,26 +139,9 @@
         // BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port = service.getPort(endpointReference, BusinessAgreementWithCoordinatorCompletionCoordinatorPortType.class, new AddressingFeature(true, true));
         BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port = service.getPort(endpointReference, BusinessAgreementWithCoordinatorCompletionCoordinatorPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
-        /*
-         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
-         */
-        List<Handler> customHandlerChain = new ArrayList<Handler>();
-		customHandlerChain.add(new WSAddressingClientHandler());
-		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
-        // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
-        // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
-        // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
-        // that the reference parameters get installed -- but how?
 
-        // the address will have been pulled out of the endpoint by getPort but we still have to set it in the
-        // addressing properties along with the action and message id
-        Map<String, Object> requestContext = bindingProvider.getRequestContext();
-        AddressingProperties requestProperties = (AddressingProperties)requestContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
-        addressingProperties.setAction(action);
-        AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
-        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
-        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
         return port;
     }
 
@@ -205,6 +154,74 @@
         // BusinessAgreementWithCoordinatorCompletionParticipantPortType port = service.getPort(endpointReference, BusinessAgreementWithCoordinatorCompletionParticipantPortType.class, new AddressingFeature(true, true));
         BusinessAgreementWithCoordinatorCompletionParticipantPortType port = service.getPort(endpointReference, BusinessAgreementWithCoordinatorCompletionParticipantPortType.class);
         BindingProvider bindingProvider = (BindingProvider)port;
+
+        configureEndpointPort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    // get ports where we have NO endpoint to create the port from
+
+    public static BusinessAgreementWithParticipantCompletionCoordinatorPortType
+    getParticipantCompletionCoordinatorPort(AttributedURI action,
+                                            AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        BusinessAgreementWithParticipantCompletionCoordinatorService service = getParticipantCompletionCoordinatorService();
+        // BusinessAgreementWithParticipantCompletionCoordinatorPortType port = service.getPort(BusinessAgreementWithParticipantCompletionParticipantPortType.class, new AddressingFeature(true, true));
+        BusinessAgreementWithParticipantCompletionCoordinatorPortType port = service.getPort(BusinessAgreementWithParticipantCompletionCoordinatorPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+    
+    public static BusinessAgreementWithParticipantCompletionParticipantPortType
+    getParticipantCompletionParticipantPort(AttributedURI action, AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        BusinessAgreementWithParticipantCompletionParticipantService service = getParticipantCompletionParticipantService();
+        // BusinessAgreementWithParticipantCompletionParticipantPortType port = service.getPort(BusinessAgreementWithParticipantCompletionParticipantPortType.class, new AddressingFeature(true, true));
+        BusinessAgreementWithParticipantCompletionParticipantPortType port = service.getPort(BusinessAgreementWithParticipantCompletionParticipantPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    public static BusinessAgreementWithCoordinatorCompletionParticipantPortType
+    getCoordinatorCompletionParticipantPort(AttributedURI action, AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        BusinessAgreementWithCoordinatorCompletionParticipantService service = getCoordinatorCompletionParticipantService();
+        // BusinessAgreementWithCoordinatorCompletionParticipantPortType port = service.getPort(BusinessAgreementWithCoordinatorCompletionParticipantPortType.class, new AddressingFeature(true, true));
+        BusinessAgreementWithCoordinatorCompletionParticipantPortType port = service.getPort(BusinessAgreementWithCoordinatorCompletionParticipantPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+    }
+
+    public static BusinessAgreementWithCoordinatorCompletionCoordinatorPortType
+    getCoordinatorCompletionCoordinatorPort(AttributedURI action, AddressingProperties addressingProperties)
+    {
+        // TODO - we need the 2.1 verison of Service so we can specify that we want to use the WS Addressing feature
+        BusinessAgreementWithCoordinatorCompletionCoordinatorService service = getCoordinatorCompletionCoordinatorService();
+        // BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port = service.getPort(BusinessAgreementWithCoordinatorCompletionCoordinatorPortType.class, new AddressingFeature(true, true));
+        BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port = service.getPort(BusinessAgreementWithCoordinatorCompletionCoordinatorPortType.class);
+        BindingProvider bindingProvider = (BindingProvider)port;
+
+        configurePort(bindingProvider, action, addressingProperties);
+
+        return port;
+
+    }
+
+    private static void configureEndpointPort(BindingProvider bindingProvider, AttributedURI action, AddressingProperties addressingProperties)
+    {
         /*
          * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
          */
@@ -213,7 +230,8 @@
 		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
         // ok, JBossWS native has hacked this by pulling the address and reference parameters out of the endpoint
         // and storing them in an AddressingProperties instance hung off the context under CLIENT_ADDRESSING_PROPERTIES_OUTBOUND.
-        // we still need to set the action and message id and possibly relatesTo -- this is all distinctly non-portable :-/
+        // we still need to set the action and message id and possibly from/faultTo/replyTo/relatesTo -- this is all
+        // distinctly non-portable :-/
         // n.b. Metro installs the address in requestContext under ENDPOINT_ADDRESS_PROPERTY. it also seems to ensure
         // that the reference parameters get installed -- but how?
 
@@ -225,6 +243,22 @@
         AddressingHelper.installCallerProperties(addressingProperties, requestProperties);
         // we should not need to do this but JBossWS does not pick up the value in the addressing properties
         requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, requestProperties.getTo().getURI().toString());
-        return port;
     }
+
+    private static void configurePort(BindingProvider bindingProvider, AttributedURI action, AddressingProperties addressingProperties)
+    {
+        /*
+         * we have to add the JaxWS WSAddressingClientHandler because we cannoy specify the WSAddressing feature
+         */
+        List<Handler> customHandlerChain = new ArrayList<Handler>();
+		customHandlerChain.add(new WSAddressingClientHandler());
+		bindingProvider.getBinding().setHandlerChain(customHandlerChain);
+        Map<String, Object> requestContext = bindingProvider.getRequestContext();
+        addressingProperties.setAction(action);
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addressingProperties);
+        // JaxWS shoudl do this for us
+        requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProperties);
+        // we should not need to do this but JBossWS does not pick up the value in the addressing properties
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, addressingProperties.getTo().getURI().toString());
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionCoordinatorPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionCoordinatorPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionCoordinatorPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,10 +5,13 @@
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices.SoapFault;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithCoordinatorCompletionCoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
@@ -245,4 +248,22 @@
             }
         }) ;
     }
+
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wscoor/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                CoordinatorCompletionCoordinatorProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionParticipantPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionParticipantPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithCoordinatorCompletionParticipantPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,9 +5,12 @@
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices.SoapFault;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithCoordinatorCompletionParticipantPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
@@ -244,4 +247,22 @@
             }
         }) ;
     }
+
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wscoor/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                CoordinatorCompletionParticipantProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionCoordinatorPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionCoordinatorPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionCoordinatorPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,10 +5,13 @@
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices.SoapFault;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithParticipantCompletionCoordinatorPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
@@ -244,4 +247,22 @@
             }
         }) ;
     }
+
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wscoor/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                ParticipantCompletionCoordinatorProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionParticipantPortTypeImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionParticipantPortTypeImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/webservices11/wsba/sei/BusinessAgreementWithParticipantCompletionParticipantPortTypeImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,9 +5,12 @@
 import com.arjuna.services.framework.task.TaskManager;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices.SoapFault;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithParticipantCompletionParticipantPortType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
+import org.jboss.jbossts.xts.soapfault.Fault;
 
 import javax.annotation.Resource;
 import javax.jws.*;
@@ -220,4 +223,22 @@
             }
         }) ;
     }
+
+    @WebMethod(operationName = "fault", action = "http://docs.oasis-open.org/ws-tx/wscoor/2006/06/fault")
+    @Oneway
+    public void fault(
+            @WebParam(name = "Fault", targetNamespace = "http://schemas.xmlsoap.org/soap/envelope/", partName = "parameters")
+            Fault fault)
+    {
+        MessageContext ctx = webServiceCtx.getMessageContext();
+        final AddressingProperties inboundAddressProperties = (AddressingProperties)ctx.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        final ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(ctx);
+        final SoapFault soapFault = SoapFault11.fromFault(fault);
+
+        TaskManager.getManager().queueTask(new Task() {
+            public void executeTask() {
+                ParticipantCompletionParticipantProcessor.getProcessor().soapFault(soapFault, inboundAddressProperties, arjunaContext); ;
+            }
+        }) ;
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionCoordinatorProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,7 +27,10 @@
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.client.CoordinatorCompletionParticipantClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -440,11 +443,12 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingContext = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingContext = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO cannot do this without an endpoint so we have to log an error message!
-            // CoordinatorCompletionParticipantClient.getClient().sendExited(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+            // supply a null endpoint indicating that the port should be configured from the addressing properties!
+            CoordinatorCompletionParticipantClient.getClient().sendExited(null, responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -467,11 +471,12 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingContext = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingContext = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO cannot do this without an endpoint so we have to log an error message!
-            // CoordinatorCompletionParticipantClient.getClient().sendFailed(responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint so that addressing properties are used to deliver message
+            CoordinatorCompletionParticipantClient.getClient().sendFailed(null, responseAddressingContext, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorCompletionParticipantProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,12 +27,17 @@
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.client.CoordinatorCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
 
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.namespace.QName;
 
 
 /**
@@ -110,8 +115,7 @@
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.cancel_2", new Object[] {instanceIdentifier}) ;
             }
-            // TODO - cannot do this as we don't have an endpoint
-            // sendCancelled(addressingProperties, arjunaContext) ;
+            sendCancelled(addressingProperties, arjunaContext) ;
         }
     }
 
@@ -149,8 +153,7 @@
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.close_2", new Object[] {instanceIdentifier}) ;
             }
-            // TODO - cannot do this as we don't have an endpoint
-            // sendClosed(addressingProperties, arjunaContext) ;
+            sendClosed(addressingProperties, arjunaContext) ;
         }
     }
 
@@ -188,8 +191,7 @@
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.compensate_2", new Object[] {instanceIdentifier}) ;
             }
-            // TODO - cannot do this as we don't have an endpoint
-            // sendCompensated(addressingProperties, arjunaContext) ;
+            sendCompensated(addressingProperties, arjunaContext) ;
         }
     }
 
@@ -228,8 +230,7 @@
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_2", new Object[] {instanceIdentifier}) ;
             }
-            // TODO - cannot do this as we don't have an endpoint
-            // sendFault(addressingProperties, arjunaContext, WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.CoordinatorCompletionParticipantProcessorImpl.complete_3")) ;
+            sendFail(addressingProperties, arjunaContext, State.STATE_ENDED.getValue()) ;
         }
     }
 
@@ -450,11 +451,12 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO - have to just log an error as we cannot do this without a client endpoint
-            // CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate addressing properties should be used to route message
+            CoordinatorCompletionCoordinatorClient.getClient().sendCancelled(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -477,11 +479,12 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO - have to just log an error as we cannot do this without a client endpoint
-            // CoordinatorCompletionCoordinatorClient.getClient().sendClosed(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate addressing properties should be used to route message
+            CoordinatorCompletionCoordinatorClient.getClient().sendClosed(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -504,11 +507,12 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO - have to just log an error as we cannot do this without a client endpoint
-            // CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate addressing properties should be used to route message
+            CoordinatorCompletionCoordinatorClient.getClient().sendCompensated(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -520,29 +524,30 @@
     }
 
     /**
-     * Send a fault message.
+     * Send a fail message.
      *
      * @param addressingProperties The addressing context.
      * @param arjunaContext The arjuna context.
      * @param exceptionIdentifier The exception identifier.
      *
-     * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1] - Unexpected exception while sending Fail
+     * @message com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFail_1 [com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFail_1] - Unexpected exception while sending Fail
      */
-    private void sendFault(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext, final String exceptionIdentifier)
+    private void sendFail(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext, final QName exceptionIdentifier)
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
+
         try
         {
-            // TODO - have to just log an error as we cannot do this without a client endpoint
-            // CoordinatorCompletionCoordinatorClient.getClient().sendFault(responseAddressingProperties, arjunaContext.getInstanceIdentifier(), exceptionIdentifier) ;
+            // supply null endpoint to indicate addressing properties should be used to route message
+            CoordinatorCompletionCoordinatorClient.getClient().sendFail(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier(), exceptionIdentifier) ;
         }
         catch (final Throwable th)
         {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
-                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFault_1", th) ;
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorCompletionCoordinatorProcessorImpl.sendFail_1", th) ;
             }
         }
     }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/CoordinatorProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -1,13 +1,19 @@
 package com.arjuna.wst11.messaging;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.base.processors.ActivatedObjectProcessor;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsat.CoordinatorInboundEvents;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices11.wsat.client.ParticipantClient;
 import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;
 
@@ -257,33 +263,19 @@
     private void sendInvalidState(final AddressingProperties addressingProperties, final ArjunaContext arjunaContext)
     {
         // KEV add check for recovery
-        final String responseMessageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingContext = AddressingHelper.createNotificationContext(responseMessageId) ;
+        final AddressingProperties faultAddressingContext = AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
 
-        /*
-         * TODO - fix this. cannot send invalid state fault as we have no participant end point!
-
-        final AttributedURI requestMessageId = addressingProperties.getMessageID() ;
-        if (requestMessageId != null)
-        {
-            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
-            Relationship relatesToValue = builder.newRelationship(requestMessageId.getURI());
-            Relationship[] relatesToSet = { relatesToValue };
-            responseAddressingContext.setRelatesTo(relatesToSet);
-        }
-
         try {
             final String message = WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.CoordinatorProcessorImpl.sendInvalidState_1") ;
-            final SoapFault soapFault = new SoapFault(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
-            ParticipantClient.getClient().sendSoapFault(responseAddressingContext, soapFault, instanceIdentifier) ;
+            final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
+            ParticipantClient.getClient().sendSoapFault(faultAddressingContext, soapFault, instanceIdentifier) ;
         } catch (final Throwable th) {
             if (WSTLogger.arjLoggerI18N.isDebugEnabled())
             {
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorProcessorImpl.sendInvalidState_2", th) ;
             }
         }
-        */
     }
 
     /**
@@ -298,14 +290,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingContext = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingContext = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-        /*
-         * TODO - fix this. cannot send rollback as we have no participant end point!
-
         try
         {
-            ParticipantClient.getClient().sendRollback(responseAddressingContext, instanceIdentifier) ;
+            ParticipantClient.getClient().sendRollback(null, responseAddressingContext, instanceIdentifier) ;
         }
         catch (final Throwable th)
         {
@@ -314,6 +303,5 @@
                 WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.CoordinatorProcessorImpl.sendRollback_1", th) ;
             }
         }
-        */
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionCoordinatorProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,7 +27,10 @@
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.client.ParticipantCompletionParticipantClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
@@ -441,11 +444,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         try
         {
-            // cannot do this without a coordinator endpoint and that is the only way it gets called
-            // ParticipantCompletionParticipantClient.getClient().sendExited(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint so that addressing properties are used to deliver message
+            ParticipantCompletionParticipantClient.getClient().sendExited(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -468,11 +471,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(  messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         try
         {
-            // cannot do this without a coordinator endpoint and that is the only way it gets called
-            // ParticipantCompletionParticipantClient.getClient().sendFaulted(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint so that addressing properties are used to deliver message
+            ParticipantCompletionParticipantClient.getClient().sendFailed(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/ParticipantCompletionParticipantProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,7 +27,10 @@
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
+import com.arjuna.webservices11.wsba.client.ParticipantCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.NotificationType;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.StatusType;
@@ -407,11 +410,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         try
         {
-            // TODO - cannot do this without a coordinator endpoint and this only gets called when we don't have one
-            // ParticipantCompletionCoordinatorClient.getClient().sendCancelled(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate that addressing properties should be used to route message
+            ParticipantCompletionCoordinatorClient.getClient().sendCancelled(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -434,11 +437,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         try
         {
-            // TODO - cannot do this without a coordinator endpoint and this only gets called when we don't have one
-            // ParticipantCompletionCoordinatorClient.getClient().sendClosed(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate that addressing properties should be used to route message
+            ParticipantCompletionCoordinatorClient.getClient().sendClosed(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {
@@ -461,11 +464,11 @@
     {
         // KEV add check for recovery
         final String messageId = MessageId.getMessageId() ;
-        final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+        final AddressingProperties responseAddressingProperties = AddressingHelper.createOneWayResponseContext(addressingProperties, messageId) ;
         try
         {
-            // TODO - cannot do this without a coordinator endpoint and this only gets called when we don't have one
-            // ParticipantCompletionCoordinatorClient.getClient().sendCompensated(responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
+            // supply null endpoint to indicate that addressing properties should be used to route message
+            ParticipantCompletionCoordinatorClient.getClient().sendCompensated(null, responseAddressingProperties, arjunaContext.getInstanceIdentifier()) ;
         }
         catch (final Throwable th)
         {

Modified: 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/TerminationCoordinatorProcessorImpl.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/TerminationCoordinatorProcessorImpl.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -27,11 +27,13 @@
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsarjtx.client.TerminationParticipantClient;
 import com.arjuna.webservices11.wsarjtx.processors.TerminationCoordinatorProcessor;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.FaultedException;
 import com.arjuna.wst.SystemException;
@@ -126,13 +128,12 @@
                 }
                 catch (final FaultedException fe)
                 {
-                    final AddressingProperties responseAddressingProperties =
-                        AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                     TerminationParticipantClient.getClient().sendFaulted(endpoint, responseAddressingProperties, instanceIdentifier) ;
                 }
                 catch (final UnknownTransactionException ute)
                 {
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
                         WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_1")) ;
                     TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
@@ -140,7 +141,7 @@
                 }
                 catch (final SystemException se)
                 {
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_2") ;
                     final String message = MessageFormat.format(pattern, new Object[] {se}) ;
                     final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
@@ -153,13 +154,12 @@
                     {
                         WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_3", th) ;
                     }
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final SoapFault soapFault = new SoapFault11(th) ;
                     TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                     return ;
                 }
-                final AddressingProperties responseAddressingProperties =
-                    AddressingHelper.createNotificationContext(messageId) ;
+                final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                 TerminationParticipantClient.getClient().sendCancelled(endpoint, responseAddressingProperties, instanceIdentifier) ;
             }
             else
@@ -168,11 +168,11 @@
                 {
                     WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_4", new Object[] {instanceIdentifier}) ;
                 }
-                // cannot do this without an endpoint
-                //final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
-                // final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTX11Constants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                //     WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_5")) ;
-                // TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
+                final AddressingProperties faultAddressingProperties =
+                        AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
+                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_5")) ;
+                 TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultAddressingProperties, instanceIdentifier) ;
             }
         }
         catch (Throwable throwable)
@@ -240,8 +240,7 @@
                     TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                     return ;
                 }
-                final AddressingProperties responseAddressingProperties =
-                    AddressingHelper.createResponseContext(addressingProperties, messageId) ;
+                final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                 TerminationParticipantClient.getClient().sendClosed(endpoint, responseAddressingProperties, instanceIdentifier) ;
             }
             else
@@ -250,11 +249,11 @@
                 {
                     WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_10", new Object[] {instanceIdentifier}) ;
                 }
-                // cannot do this without an endpoint
-                // final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
-                // final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTX11Constants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                //     WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_11")) ;
-                // TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
+                final AddressingProperties faultAddressingProperties =
+                        AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
+                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
+                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_11")) ;
+                TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultAddressingProperties, instanceIdentifier) ;
             }
         }
         catch (Throwable throwable)
@@ -288,13 +287,12 @@
                 }
                 catch (final FaultedException fe)
                 {
-                    final AddressingProperties responseAddressingProperties =
-                        AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                     TerminationParticipantClient.getClient().sendFaulted(endpoint, responseAddressingProperties, instanceIdentifier) ;
                 }
                 catch (final UnknownTransactionException ute)
                 {
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
                         WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_12")) ;
                     TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
@@ -302,7 +300,7 @@
                 }
                 catch (final SystemException se)
                 {
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_13") ;
                     final String message = MessageFormat.format(pattern, new Object[] {se}) ;
                     final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
@@ -315,13 +313,12 @@
                     {
                         WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_14", th) ;
                     }
-                    final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
+                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                     final SoapFault soapFault = new SoapFault11(th) ;
                     TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                     return ;
                 }
-                final AddressingProperties responseAddressingProperties =
-                    AddressingHelper.createNotificationContext(messageId) ;
+                final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                 TerminationParticipantClient.getClient().sendCompleted(endpoint, responseAddressingProperties, instanceIdentifier) ;
             }
             else
@@ -330,11 +327,12 @@
                 {
                     WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_15", new Object[] {instanceIdentifier}) ;
                 }
-                // cannot do this without an endpoint
-                // final AddressingProperties faultAddressingProperties = AddressingHelper.createNotificationContext(MessageId.getMessageId()) ;
-                // final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTX11Constants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
-                //     WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_16")) ;
-                // TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
+                final AddressingProperties faultAddressingProperties =
+                        AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
+                final SoapFault soapFault =
+                        new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
+                                WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_16")) ;
+                TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultAddressingProperties, instanceIdentifier) ;
             }
         }
         catch (Throwable throwable)
@@ -342,4 +340,26 @@
             throwable.printStackTrace(System.err);
         }
     }
+
+    /**
+     * handle a soap fault sent by the participant.
+     *
+     * kev's code just prints a log message?
+     *
+     * @param soapFault The soap fault
+     * @param addressingProperties The addressing context.
+     * @param arjunaContext The arjuna context.
+     * @message com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_17 [com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_17] - Service {0} received unexpected fault: {1}
+     */
+    public void soapFault(final SoapFault soapFault, final AddressingProperties addressingProperties,
+        final ArjunaContext arjunaContext)
+    {
+        // in this case all we do is log a message
+
+        if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+        {
+            WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_17",
+                    new Object[] {ArjunaTXConstants.SERVICE_TERMINATION_COORDINATOR, soapFault}) ;
+        }
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionCoordinatorEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -21,15 +21,21 @@
 package com.arjuna.wst11.messaging.engines;
 
 import com.arjuna.webservices.SoapFault;
+import com.arjuna.webservices.SoapFaultType;
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
+import com.arjuna.webservices11.wsaddr.client.SoapFaultClient;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionCoordinatorProcessor;
 import com.arjuna.webservices11.wsba.client.CoordinatorCompletionParticipantClient;
+import com.arjuna.webservices11.ServiceRegistry;
+import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.wscoor.CoordinationConstants;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst11.BAParticipantManager;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
@@ -38,7 +44,10 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.AddressingBuilder;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import java.net.URISyntaxException;
 
 /**
  * The coordinator completion coordinator state engine
@@ -253,8 +262,7 @@
         }
         else if (current == State.STATE_ACTIVE)
         {
-            // TODO - we cannot send a fault here
-            // sendInvalidStateFault() ;
+            sendInvalidStateFault() ;
         }
     }
 
@@ -797,6 +805,30 @@
     }
 
     /**
+     * Send the invalid state fault message.
+     *
+     * @message com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_1 [com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_1] - Unexpected exception while sending InvalidStateFault
+     * @message com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_2 [com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_2] - Invalid coordinator completion coordinator state
+     */
+    private void sendInvalidStateFault()
+    {
+        final AddressingProperties addressingProperties = createContext() ;
+        try
+        {
+            final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME,
+                    WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_2")) ;
+            SoapFaultClient.sendSoapFault(soapFault, participant, addressingProperties, getFaultAction()) ;
+        }
+        catch (final Throwable th)
+        {
+            if (WSTLogger.arjLoggerI18N.isDebugEnabled())
+            {
+                WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.engines.CoordinatorCompletionCoordinatorEngine.sendInvalidStateFault_1", th) ;
+            }
+        }
+    }
+
+    /**
      * Get the coordinator id.
      * @return The coordinator id.
      */
@@ -975,6 +1007,24 @@
     private AddressingProperties createContext()
     {
         final String messageId = MessageId.getMessageId() ;
+
         return AddressingHelper.createNotificationContext(messageId) ;
     }
+
+    private static AttributedURI faultAction = null;
+
+    private static synchronized AttributedURI getFaultAction()
+    {
+        if (faultAction == null) {
+            AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
+
+            try {
+                faultAction = builder.newURI(CoordinationConstants.WSCOOR_ACTION_FAULT);
+            } catch (URISyntaxException e) {
+                // TODO log error here
+            }
+        }
+        
+        return faultAction;
+    }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorCompletionParticipantEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -29,8 +29,10 @@
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents;
 import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.client.CoordinatorCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.CoordinatorCompletionParticipantProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant;
 import com.arjuna.wst.FaultedException;
@@ -1069,6 +1071,7 @@
     private AddressingProperties createContext()
     {
         final String messageId = MessageId.getMessageId() ;
+
         return AddressingHelper.createNotificationContext(messageId) ;
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/CoordinatorEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -5,11 +5,13 @@
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.util.TransportTimer;
 import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.webservices11.wsaddr.AddressingHelper;
 import com.arjuna.webservices11.wsarj.ArjunaContext;
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsat.CoordinatorInboundEvents;
 import com.arjuna.webservices11.wsat.State;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.client.ParticipantClient;
 import com.arjuna.webservices11.wsat.processors.CoordinatorProcessor;
 import com.arjuna.webservices11.wscoor.CoordinationConstants;
@@ -540,19 +542,12 @@
     {
         try
         {
-            final AddressingProperties responseContext = createContext() ;
-            final AttributedURI messageId = addressingProperties.getMessageID() ;
+            final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
             final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier() ;
-            if (messageId != null)
-            {
-                AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
-                Relationship[] relatesTo = new Relationship[] { builder.newRelationship(messageId.getURI()) };
-                responseContext.setRelatesTo(relatesTo);
-            }
 
             final String message = WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.engines.CoordinatorEngine.sendInvalidState_1") ;
             final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, message) ;
-            ParticipantClient.getClient().sendSoapFault(participant, responseContext, soapFault, instanceIdentifier) ;
+            ParticipantClient.getClient().sendSoapFault(faultAddressingProperties, soapFault, instanceIdentifier) ;
         }
         catch (final Throwable th)
         {
@@ -594,6 +589,7 @@
     private AddressingProperties createContext()
     {
         final String messageId = MessageId.getMessageId() ;
+
         return AddressingHelper.createNotificationContext(messageId) ;
     }
 }

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionCoordinatorEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -28,8 +28,10 @@
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents;
 import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionCoordinatorProcessor;
 import com.arjuna.webservices11.wsba.client.ParticipantCompletionParticipantClient;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst11.BAParticipantManager;
 import org.oasis_open.docs.ws_tx.wsba._2006._06.ExceptionType;
@@ -870,6 +872,7 @@
     private AddressingProperties createContext()
     {
         final String messageId = MessageId.getMessageId() ;
+
         return AddressingHelper.createNotificationContext(messageId);
     }
 }
\ No newline at end of file

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantCompletionParticipantEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -29,8 +29,10 @@
 import com.arjuna.webservices11.wsarj.InstanceIdentifier;
 import com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents;
 import com.arjuna.webservices11.wsba.State;
+import com.arjuna.webservices11.wsba.BusinessActivityConstants;
 import com.arjuna.webservices11.wsba.client.ParticipantCompletionCoordinatorClient;
 import com.arjuna.webservices11.wsba.processors.ParticipantCompletionParticipantProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.BusinessAgreementWithParticipantCompletionParticipant;
 import com.arjuna.wst.FaultedException;

Modified: labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantEngine.java
===================================================================
--- labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantEngine.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/messaging/engines/ParticipantEngine.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -11,7 +11,9 @@
 import com.arjuna.webservices11.wsat.client.CoordinatorClient;
 import com.arjuna.webservices11.wsat.ParticipantInboundEvents;
 import com.arjuna.webservices11.wsat.State;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
 import com.arjuna.webservices11.wsat.processors.ParticipantProcessor;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.*;
 import org.oasis_open.docs.ws_tx.wsat._2006._06.Notification;

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	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/BusinessActivityTerminatorStub.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -32,12 +32,14 @@
 import com.arjuna.webservices.logging.WSTLogger;
 import com.arjuna.webservices.wsarjtx.ArjunaTXConstants;
 import com.arjuna.webservices11.SoapFault11;
+import com.arjuna.webservices11.ServiceRegistry;
 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.processors.TerminationParticipantCallback;
 import com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor;
+import com.arjuna.webservices11.wsarjtx.ArjunaTX11Constants;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.FaultedException;
 import com.arjuna.wst.SystemException;
@@ -223,8 +225,7 @@
                 WSTLogger.log_mesg.getString("com.arjuna.wst11.stub.BusinessActivityTerminatorStub_1")) ;
         try
         {
-            // the terminaron coordinator endpoint does not expose a soapFault web method as this never gets called
-            // TerminationCoordinatorClient.getClient().sendSoapFault(_terminationCoordinator, addressingProperties, soapFault, new InstanceIdentifier(_id)) ;
+            TerminationCoordinatorClient.getClient().sendSoapFault(_terminationCoordinator, addressingProperties, soapFault, new InstanceIdentifier(_id)) ;
         }
         catch (final Throwable th)
         {

Modified: 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/CompletionStub.java	2008-05-01 15:07:58 UTC (rev 19811)
+++ labs/jbosstm/trunk/XTS/WS-T/dev/src11/com/arjuna/wst11/stub/CompletionStub.java	2008-05-01 15:40:27 UTC (rev 19812)
@@ -8,6 +8,8 @@
 import com.arjuna.webservices11.wsat.client.CompletionCoordinatorClient;
 import com.arjuna.webservices11.wsat.processors.CompletionInitiatorCallback;
 import com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor;
+import com.arjuna.webservices11.wsat.AtomicTransactionConstants;
+import com.arjuna.webservices11.ServiceRegistry;
 import com.arjuna.wsc11.messaging.MessageId;
 import com.arjuna.wst.SystemException;
 import com.arjuna.wst.TransactionRolledBackException;




More information about the jboss-svn-commits mailing list