New interop testing code 

diff --git a/test/interop/CommitTestResource.java b/test/interop/CommitTestResource.java
new file mode 100644
index 0000000..4000a5c
--- /dev/null
+++ b/test/interop/CommitTestResource.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class CommitTestResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public CommitTestResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+
+	}
+
+	public Vote prepare() {
+		return Vote.PREPARED;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_DURABLE2PC;
+	}
+
+}
\ No newline at end of file
diff --git a/test/interop/DurableReadOnlyResource.java b/test/interop/DurableReadOnlyResource.java
new file mode 100644
index 0000000..3031d83
--- /dev/null
+++ b/test/interop/DurableReadOnlyResource.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class DurableReadOnlyResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public DurableReadOnlyResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+	}
+
+	public Vote prepare() {
+		return Vote.READ_ONLY;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_DURABLE2PC;
+	}
+
+
+}
\ No newline at end of file
diff --git a/test/interop/InteropTest.java b/test/interop/InteropTest.java
new file mode 100644
index 0000000..129e05a
--- /dev/null
+++ b/test/interop/InteropTest.java
@@ -0,0 +1,116 @@
+/*

+ * Copyright 2004,2005 The Apache Software Foundation.

+ * 

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package interop;

+

+/**

+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>

+ */

+

+import junit.framework.TestCase;

+

+import org.apache.axis2.addressing.EndpointReference;

+import org.apache.kandula.Constants;

+import org.apache.kandula.initiator.TransactionManager;

+

+public class InteropTest extends TestCase {

+

+	EndpointReference coordinator = new EndpointReference(

+			"http://localhost:8085/axis2/services/ActivationCoordinator");

+

+	String axis2Repo = "target/initiator-repository";

+

+	String axis2XML = "target/initiator-repository/axis2.xml";

+

+	TestServiceStub stub = new TestServiceStub("target/initiator-repository",

+			new EndpointReference(

+					"http://localhost:8085/axis2/services/TestService"));

+

+	public InteropTest() throws Exception {

+		super(InteropTest.class.getName());

+	}

+

+	public InteropTest(String testName) throws Exception {

+		super(testName);

+	}

+

+	public void testCompletionCommit() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		tm.commit();

+	}

+

+	public void testCompletionRollback() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		tm.rollback();

+	}

+

+	public void testCommit() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.commitOperation();

+		tm.commit();

+	}

+

+	public void testRollback() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.rollbackOperation();

+		tm.rollback();

+	}

+

+	public void testPhase2Rollback() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.phase2RollbackOperation();

+

+		boolean done = false;

+		try {

+			tm.commit();

+		} catch (Exception e) {

+			done = true;

+		}

+		assertTrue(done);

+	}

+

+	public void testReadonly() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.readonlyOperation();

+		tm.commit();

+	}

+

+	public void testVolatileAndDurable() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.readonlyOperation();

+		tm.commit();

+	}

+	public void testEarlyAborted() throws Exception {

+		TransactionManager tm = new TransactionManager(Constants.WS_AT,

+				coordinator, axis2Repo, axis2XML);

+		tm.begin(true);

+		stub.earlyAbortedOperation();

+	}

+}
\ No newline at end of file
diff --git a/test/interop/META-INF/services.xml b/test/interop/META-INF/services.xml
new file mode 100644
index 0000000..f5374f0
--- /dev/null
+++ b/test/interop/META-INF/services.xml
@@ -0,0 +1,27 @@
+<service name="TestService">

+	<description>

+    	Sample service for Testing

+	</description>

+    <module ref="kandula-inflow"/>

+   	<parameter name="ServiceClass" locked="xsd:false">interop.testService</parameter>

+    <operation name="Commit">

+		<parameter name="KandulaResource" locked="xsd:false">interop.CommitTestResource</parameter>

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+	</operation>

+	<operation name="Rollback">

+		<parameter name="KandulaResource" locked="xsd:false">interop.RollbackTestResource</parameter>

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+	</operation>

+	<operation name="Phase2Rollback">

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+    </operation>

+	<operation name="Readonly">

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+    </operation>

+    <operation name="VolatileAndDurable">

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+    </operation>

+    <operation name="EarlyAborted">

+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

+    </operation>

+</service>

diff --git a/test/interop/Phase2RollbackTestVolatileResource.java b/test/interop/Phase2RollbackTestVolatileResource.java
new file mode 100644
index 0000000..c513c95
--- /dev/null
+++ b/test/interop/Phase2RollbackTestVolatileResource.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class Phase2RollbackTestVolatileResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public Phase2RollbackTestVolatileResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+
+	}
+
+	public Vote prepare() {
+		return Vote.PREPARED;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_VOLATILE2PC;
+	}
+}
\ No newline at end of file
diff --git a/test/interop/RollbackTestResource.java b/test/interop/RollbackTestResource.java
new file mode 100644
index 0000000..863215c
--- /dev/null
+++ b/test/interop/RollbackTestResource.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class RollbackTestResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public RollbackTestResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+
+	}
+
+	public Vote prepare() {
+		return Vote.ABORT;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_DURABLE2PC;
+	}
+}
\ No newline at end of file
diff --git a/test/interop/TestServiceStub.java b/test/interop/TestServiceStub.java
new file mode 100644
index 0000000..79cefaf
--- /dev/null
+++ b/test/interop/TestServiceStub.java
@@ -0,0 +1,225 @@
+/*

+ * Copyright  2004 The Apache Software Foundation.

+ *

+ *  Licensed under the Apache License, Version 2.0 (the "License");

+ *  you may not use this file except in compliance with the License.

+ *  You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ *

+ */

+package interop;

+

+import java.io.IOException;

+

+import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

+import org.apache.axiom.soap.SOAPEnvelope;

+import org.apache.axiom.soap.SOAPFactory;

+import org.apache.axis2.AxisFault;

+import org.apache.axis2.addressing.AddressingConstants;

+import org.apache.axis2.addressing.EndpointReference;

+import org.apache.axis2.client.OperationClient;

+import org.apache.axis2.client.Options;

+import org.apache.axis2.context.ConfigurationContext;

+import org.apache.axis2.context.ConfigurationContextFactory;

+import org.apache.axis2.context.MessageContext;

+import org.apache.axis2.context.ServiceContext;

+import org.apache.axis2.context.ServiceGroupContext;

+import org.apache.axis2.description.AxisOperation;

+import org.apache.axis2.description.AxisService;

+import org.apache.axis2.description.AxisServiceGroup;

+import org.apache.axis2.description.OutInAxisOperation;

+

+/**

+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>

+ */

+

+public class TestServiceStub extends org.apache.axis2.client.Stub {

+

+	public static final String AXIS2_HOME = ".";

+

+	// private AxisService service;

+	private ConfigurationContext configurationContext;

+

+	private ServiceContext serviceContext;

+

+	private EndpointReference toEPR;

+

+	private static org.apache.axis2.description.AxisOperation[] operations;

+	{// creating the Service

+		_service = new AxisService("TestService");

+

+		// creating the operations

+		AxisOperation operationDesc;

+		operations = new org.apache.axis2.description.AxisOperation[1];

+

+		operationDesc = new OutInAxisOperation();

+		operationDesc.setName(new javax.xml.namespace.QName("Commit"));

+		operations[0] = operationDesc;

+		_service.addOperation(operationDesc);

+	}

+

+	/**

+	 * Constructor

+	 */

+	public TestServiceStub(String axis2Home,

+			EndpointReference targetEndpoint) throws java.lang.Exception {

+		this.toEPR = targetEndpoint;

+		// creating the configuration

+		configurationContext = ConfigurationContextFactory

+				.createConfigurationContextFromFileSystem(axis2Home, axis2Home

+						+ "/axis2.xml");

+		configurationContext.getAxisConfiguration().addService(_service);

+		ServiceGroupContext sgc = new ServiceGroupContext(

+				this.configurationContext, (AxisServiceGroup) _service

+						.getParent());

+		this.serviceContext = new ServiceContext(_service, sgc);

+

+	}

+

+	public void commitOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		options.setAction("Commit");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+

+	}

+

+	public void rollbackOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("Rollback");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+	public void phase2RollbackOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("Phase2Rollback");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+	public void readonlyOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("Readonly");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+	public void volatileAndDurableOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("VolatileAndDurable");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+	public void earlyAbortedOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("EarlyAborted");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+

+	private SOAPEnvelope createSOAPEnvelope() {

+

+		SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();

+		SOAPEnvelope env = factory.getDefaultEnvelope();

+//		SOAPBody body = factory.createSOAPBody();

+//		env.addChild(body);

+		OMElement test = factory.createOMElement("test","urn://temp", "tmp");

+		env.getBody().addChild(test);

+		return env;

+	}

+

+}
\ No newline at end of file
diff --git a/test/interop/VolatileAndDurableTestVolatileResource.java b/test/interop/VolatileAndDurableTestVolatileResource.java
new file mode 100644
index 0000000..db8ea10
--- /dev/null
+++ b/test/interop/VolatileAndDurableTestVolatileResource.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class VolatileAndDurableTestVolatileResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public VolatileAndDurableTestVolatileResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+
+	}
+
+	public Vote prepare() {
+		return Vote.READ_ONLY;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_VOLATILE2PC;
+	}
+
+}
\ No newline at end of file
diff --git a/test/interop/VolatileReadOnlyResource.java b/test/interop/VolatileReadOnlyResource.java
new file mode 100644
index 0000000..f32a466
--- /dev/null
+++ b/test/interop/VolatileReadOnlyResource.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class VolatileReadOnlyResource implements KandulaResource {
+
+	/**
+	 * 
+	 */
+	public VolatileReadOnlyResource() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean commit() {
+		System.out.println("Commited");
+		return true;
+	}
+
+	public void rollback() {
+		System.out.println("rollback");
+	}
+
+	public Vote prepare() {
+		return Vote.READ_ONLY;
+	}
+
+	public String getProtocol() {
+		return Constants.WS_AT_VOLATILE2PC;
+	}
+
+}
\ No newline at end of file
diff --git a/test/interop/testService.java b/test/interop/testService.java
new file mode 100644
index 0000000..f9ce57e
--- /dev/null
+++ b/test/interop/testService.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright  2004 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package interop;
+
+import java.util.Map;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.CoordinationContext;
+import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.ParticipantUtility;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
+import org.apache.kandula.wsat.twopc.CoordinatorPortTypeRawXMLStub;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class testService {
+
+	private MessageContext msgcts;
+
+	public testService() {
+
+	}
+
+	public void setOperationContext(OperationContext oc) throws AxisFault {
+		msgcts = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+	}
+
+	public OMElement Commit(OMElement element) {
+		element.build();
+		element.detach();
+		return element;
+	}
+
+	public OMElement Rollback(OMElement element) {
+		element.build();
+		element.detach();
+		return element;
+	}
+
+	public OMElement Phase2Rollback(OMElement element) throws AxisFault {
+		element.build();
+		element.detach();
+		String reqID = (String) msgcts
+				.getProperty(AbstractContext.REQUESTER_ID);
+		Store store = StorageFactory.getInstance().getStore();
+		ATParticipantContext participantContext = (ATParticipantContext) store
+				.get(reqID);
+		CoordinationContext coordinationContext = participantContext
+				.getCoordinationContext();
+
+		ATParticipantContext participantContext2 = new ATParticipantContext();
+		participantContext2.setCoordinationContext(coordinationContext);
+		KandulaResource resource1 = new Phase2RollbackTestVolatileResource();
+		participantContext2.setResource(resource1);
+		store.put(participantContext2.getID(), participantContext2);
+		ParticipantUtility.registerParticipant(participantContext2);
+
+		ATParticipantContext participantContext1 = new ATParticipantContext();
+		participantContext1.setCoordinationContext(coordinationContext);
+		KandulaResource resource = new RollbackTestResource();
+		participantContext1.setResource(resource);
+		store.put(participantContext1.getID(), participantContext1);
+		ParticipantUtility.registerParticipant(participantContext1);
+
+		return element;
+	}
+
+	public OMElement Readonly(OMElement element) throws AxisFault {
+		element.build();
+		element.detach();
+		String reqID = (String) msgcts
+				.getProperty(AbstractContext.REQUESTER_ID);
+		Store store = StorageFactory.getInstance().getStore();
+		ATParticipantContext participantContext = (ATParticipantContext) store
+				.get(reqID);
+		CoordinationContext coordinationContext = participantContext
+				.getCoordinationContext();
+
+		ATParticipantContext participantContext2 = new ATParticipantContext();
+		participantContext2.setCoordinationContext(coordinationContext);
+		KandulaResource resource1 = new DurableReadOnlyResource();
+		participantContext2.setResource(resource1);
+		store.put(participantContext2.getID(), participantContext2);
+		ParticipantUtility.registerParticipant(participantContext2);
+
+		ATParticipantContext participantContext1 = new ATParticipantContext();
+		participantContext1.setCoordinationContext(coordinationContext);
+		KandulaResource resource = new CommitTestResource();
+		participantContext1.setResource(resource);
+		store.put(participantContext1.getID(), participantContext1);
+		ParticipantUtility.registerParticipant(participantContext1);
+
+		return element;
+	}
+
+	public OMElement VolatileAndDurable(OMElement element) throws AxisFault {
+		element.build();
+		element.detach();
+		String reqID = (String) msgcts
+				.getProperty(AbstractContext.REQUESTER_ID);
+		final Store store = StorageFactory.getInstance().getStore();
+		ATParticipantContext participantContext = (ATParticipantContext) store
+				.get(reqID);
+		final CoordinationContext coordinationContext = participantContext
+				.getCoordinationContext();
+
+		final ATParticipantContext participantContext2 = new ATParticipantContext();
+		participantContext2.setCoordinationContext(coordinationContext);
+		KandulaResource resource1 = new VolatileAndDurableTestVolatileResource();
+		participantContext2.setResource(resource1);
+		store.put(participantContext2.getID(), participantContext2);
+		ParticipantUtility.registerParticipant(participantContext2);
+		Thread thread = new Thread(new Runnable() {
+			public void run() {
+				try {
+					ATParticipantContext participantContext1 = new ATParticipantContext();
+					participantContext1
+							.setCoordinationContext(coordinationContext);
+					KandulaResource resource = new CommitTestResource();
+					participantContext1.setResource(resource);
+					store.put(participantContext1.getID(), participantContext1);
+
+					Map referenceParametersmap = participantContext2
+							.getCoordinationEPR().getAllReferenceParameters();
+					String id = ((OMElement) referenceParametersmap
+							.get(Constants.TRANSACTION_ID_PARAMETER)).getText();
+					AbstractContext transaction = (AbstractContext) store
+							.get(id);
+					while (!(transaction.getStatus() == Status.CoordinatorStatus.STATUS_PREPARING_VOLATILE)) {
+					}
+					ParticipantUtility.registerParticipant(participantContext1);
+
+				} catch (AxisFault e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		});
+		thread.start();
+		return element;
+	}
+
+	public OMElement EarlyAborted(OMElement element) throws AxisFault {
+		element.build();
+		element.detach();
+		String reqID = (String) msgcts
+				.getProperty(AbstractContext.REQUESTER_ID);
+		Store store = StorageFactory.getInstance().getStore();
+		ATParticipantContext participantContext = (ATParticipantContext) store
+				.get(reqID);
+		CoordinationContext coordinationContext = participantContext
+				.getCoordinationContext();
+
+		ATParticipantContext participantContext2 = new ATParticipantContext();
+		participantContext2.setCoordinationContext(coordinationContext);
+		KandulaResource resource1 = new CommitTestResource();
+		participantContext2.setResource(resource1);
+		store.put(participantContext2.getID(), participantContext2);
+		ParticipantUtility.registerParticipant(participantContext2);
+
+		ATParticipantContext participantContext1 = new ATParticipantContext();
+		participantContext1.setCoordinationContext(coordinationContext);
+		KandulaResource resource = new VolatileReadOnlyResource();
+		participantContext1.setResource(resource);
+		store.put(participantContext1.getID(), participantContext1);
+		ParticipantUtility.registerParticipant(participantContext1);
+
+		CoordinatorPortTypeRawXMLStub stub;
+		try {
+			stub = new CoordinatorPortTypeRawXMLStub(participantContext1
+					.getCoordinationEPR());
+			stub.abortedOperation();
+		} catch (AbstractKandulaException e) {
+			throw new AxisFault(e);
+		}
+
+		return element;
+	}
+}
\ No newline at end of file
diff --git a/test/org/apache/kandula/context/ActivityContextTest.java b/test/org/apache/kandula/context/ActivityContextTest.java
index 90f4e17..ab8b6e2 100644
--- a/test/org/apache/kandula/context/ActivityContextTest.java
+++ b/test/org/apache/kandula/context/ActivityContextTest.java
@@ -1,50 +1,50 @@
-/*
- * Copyright  2004 The Apache Software Foundation.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package org.apache.kandula.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class ActivityContextTest extends TestCase {
-
-	public void testGetActivityID() {
-		// TODO Implement getActivityID().
-	}
-
-	public void testAddParticipant() {
-		// TODO Implement addParticipant().
-	}
-
-	public void testGetStatus() {
-		// TODO Implement getStatus().
-	}
-
-	public void testSetStatus() {
-		// TODO Implement setStatus().
-	}
-
-	public void testLock() {
-		// TODO Implement lock().
-	}
-
-	public void testUnlock() {
-		// TODO Implement unlock().
-	}
-
-}
\ No newline at end of file
+/*

+ * Copyright  2004 The Apache Software Foundation.

+ *

+ *  Licensed under the Apache License, Version 2.0 (the "License");

+ *  you may not use this file except in compliance with the License.

+ *  You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ *

+ */

+package org.apache.kandula.context;

+

+import junit.framework.TestCase;

+

+/**

+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>

+ */

+public class ActivityContextTest extends TestCase {

+

+	public void testGetActivityID() {

+		// TODO Implement getActivityID().

+	}

+

+	public void testAddParticipant() {

+		// TODO Implement addParticipant().

+	}

+

+	public void testGetStatus() {

+		// TODO Implement getStatus().

+	}

+

+	public void testSetStatus() {

+		// TODO Implement setStatus().

+	}

+

+	public void testLock() {

+		// TODO Implement lock().

+	}

+

+	public void testUnlock() {

+		// TODO Implement unlock().

+	}

+

+}

diff --git a/test/org/apache/kandula/coordinator/CoordinatorImplTest.java b/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
index 3601f73..39951c8 100644
--- a/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
+++ b/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
@@ -1,89 +1,89 @@
-/*
- * Copyright  2004 The Apache Software Foundation.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package org.apache.kandula.coordinator;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.kandula.Constants;
-import org.apache.kandula.Status;
-import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.CoordinationContext;
-import org.apache.kandula.context.impl.ATActivityContext;
-import org.apache.kandula.faults.AbstractKandulaException;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class CoordinatorImplTest extends TestCase {
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/*
-	 * @see TestCase#tearDown()
-	 */
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	/*
-	 * Class under test for ActivityContext createCoordinationContext(String,
-	 * long)
-	 */
-	public void testCreateCoordinationContextStringlong()
-			throws AbstractKandulaException {
-		Coordinator coordinator = new Coordinator();
-		AbstractContext context = coordinator.createCoordinationContext(
-				Constants.WS_AT, 3000);
-		assertTrue(ATActivityContext.class.isInstance(context));
-		assertNotNull(context.getCoordinationContext());
-		assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
-	}
-
-	/*
-	 * Class under test for ActivityContext
-	 * createCoordinationContext(CoordinationContext)
-	 */
-	public void testCreateCoordinationContextCoordinationContext()
-			throws AbstractKandulaException {
-		Coordinator coordinator = new Coordinator();
-		CoordinationContext coorContext = CoordinationContext.Factory
-				.newContext("uuid:29919219jdk02102021", Constants.WS_AT,
-						new EndpointReference(""));
-		coorContext.setExpires(3000);
-		// coorContext.setRegistrationService()
-		AbstractContext context = coordinator
-				.createCoordinationContext(coorContext);
-		assertTrue(ATActivityContext.class.isInstance(context));
-		assertNotNull(context.getCoordinationContext());
-		assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
-		assertEquals(context.getCoordinationContext().getCoordinationType(),
-				coorContext.getCoordinationType());
-		assertEquals(context.getCoordinationContext().getActivityID(),
-				coorContext.getActivityID());
-	}
-
-	public void testRegisterParticipant() {
-		// TODO Implement registerParticipant().
-	}
-
-}
\ No newline at end of file
+/*

+ * Copyright  2004 The Apache Software Foundation.

+ *

+ *  Licensed under the Apache License, Version 2.0 (the "License");

+ *  you may not use this file except in compliance with the License.

+ *  You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ *

+ */

+package org.apache.kandula.coordinator;

+

+import junit.framework.TestCase;

+

+import org.apache.axis2.addressing.EndpointReference;

+import org.apache.kandula.Constants;

+import org.apache.kandula.Status;

+import org.apache.kandula.context.AbstractContext;

+import org.apache.kandula.context.CoordinationContext;

+import org.apache.kandula.context.impl.ATActivityContext;

+import org.apache.kandula.faults.AbstractKandulaException;

+

+/**

+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>

+ */

+public class CoordinatorImplTest extends TestCase {

+

+	/*

+	 * @see TestCase#setUp()

+	 */

+	protected void setUp() throws Exception {

+		super.setUp();

+	}

+

+	/*

+	 * @see TestCase#tearDown()

+	 */

+	protected void tearDown() throws Exception {

+		super.tearDown();

+	}

+

+	/*

+	 * Class under test for ActivityContext createCoordinationContext(String,

+	 * long)

+	 */

+	public void testCreateCoordinationContextStringlong()

+			throws AbstractKandulaException {

+		Coordinator coordinator = new Coordinator();

+		AbstractContext context = coordinator.createCoordinationContext(

+				Constants.WS_AT, 3000);

+		assertTrue(ATActivityContext.class.isInstance(context));

+		assertNotNull(context.getCoordinationContext());

+		assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);

+	}

+

+	/*

+	 * Class under test for ActivityContext

+	 * createCoordinationContext(CoordinationContext)

+	 */

+	public void testCreateCoordinationContextCoordinationContext()

+			throws AbstractKandulaException {

+		Coordinator coordinator = new Coordinator();

+		CoordinationContext coorContext = CoordinationContext.Factory

+				.newContext("uuid:29919219jdk02102021", Constants.WS_AT,

+						new EndpointReference(""));

+		coorContext.setExpires(3000);

+		// coorContext.setRegistrationService()

+		AbstractContext context = coordinator

+				.createCoordinationContext(coorContext);

+		assertTrue(ATActivityContext.class.isInstance(context));

+		assertNotNull(context.getCoordinationContext());

+		assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);

+		assertEquals(context.getCoordinationContext().getCoordinationType(),

+				coorContext.getCoordinationType());

+		assertEquals(context.getCoordinationContext().getActivityID(),

+				coorContext.getActivityID());

+	}

+

+	public void testRegisterParticipant() {

+		// TODO Implement registerParticipant().

+	}

+

+}

diff --git a/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java b/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
index 40190c9..8de2f46 100644
--- a/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
+++ b/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
@@ -1,50 +1,50 @@
-/*
- * Copyright  2004 The Apache Software Foundation.
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-package org.apache.kandula.coordinator.at;
-
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class ATCoordinatorTest extends TestCase {
-
-	/*
-	 * @see TestCase#setUp()
-	 */
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	/**
-	 * Constructor for ATCoordinatorTest.
-	 * 
-	 * @param arg0
-	 */
-	public ATCoordinatorTest(String arg0) {
-		super(arg0);
-	}
-
-	public void testCommitOperation() {
-		// TODO Implement commitOperation().
-	}
-
-	public void testRollbackOperation() {
-		// TODO Implement rollbackOperation().
-	}
-
-}
\ No newline at end of file
+/*

+ * Copyright  2004 The Apache Software Foundation.

+ *

+ *  Licensed under the Apache License, Version 2.0 (the "License");

+ *  you may not use this file except in compliance with the License.

+ *  You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing, software

+ *  distributed under the License is distributed on an "AS IS" BASIS,

+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ *  See the License for the specific language governing permissions and

+ *  limitations under the License.

+ *

+ */

+package org.apache.kandula.coordinator.at;

+

+import junit.framework.TestCase;

+

+/**

+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>

+ */

+public class ATCoordinatorTest extends TestCase {

+

+	/*

+	 * @see TestCase#setUp()

+	 */

+	protected void setUp() throws Exception {

+		super.setUp();

+	}

+

+	/**

+	 * Constructor for ATCoordinatorTest.

+	 * 

+	 * @param arg0

+	 */

+	public ATCoordinatorTest(String arg0) {

+		super(arg0);

+	}

+

+	public void testCommitOperation() {

+		// TODO Implement commitOperation().

+	}

+

+	public void testRollbackOperation() {

+		// TODO Implement rollbackOperation().

+	}

+

+}

diff --git a/test/org/apache/kandula/integration/CreateCoordinationContextTest.java b/test/org/apache/kandula/integration/CompletionCommitTest.java
similarity index 60%
rename from test/org/apache/kandula/integration/CreateCoordinationContextTest.java
rename to test/org/apache/kandula/integration/CompletionCommitTest.java
index 632415e..6b10391 100644
--- a/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
+++ b/test/org/apache/kandula/integration/CompletionCommitTest.java
@@ -20,6 +20,8 @@
  * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>

  */

 

+import interop.TestServiceStub;

+

 import java.io.File;

 

 import junit.framework.TestCase;

@@ -31,25 +33,33 @@
 import org.apache.kandula.Constants;

 import org.apache.kandula.initiator.TransactionManager;

 

-public class CreateCoordinationContextTest extends TestCase {

+public class CompletionCommitTest extends TestCase {

 

-	private String repository = "target/testing-repository";

+	private String repository = "C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/axis2/WEB-INF";

 

-//	private KandulaDemoServiceStub stub;

+	private KandulaDemoServiceStub stub;

 

 	private SimpleHTTPServer server;

 

-	public CreateCoordinationContextTest() throws Exception {

-		super(CreateCoordinationContextTest.class.getName());

+	public CompletionCommitTest() throws Exception {

+		super(CompletionCommitTest.class.getName());

+		stub = new KandulaDemoServiceStub(

+				"target/initiator-repository",

+				new EndpointReference(

+						"http://localhost:8082/axis2/services/TestService"));

 	}

 

-	public CreateCoordinationContextTest(String testName) throws Exception {

+	public CompletionCommitTest(String testName) throws Exception {

 		super(testName);

+		stub = new KandulaDemoServiceStub(

+				"target/initiator-repository",

+				new EndpointReference(

+						"http://localhost:8082/axis2/services/TestService"));

 	}

 

 	protected void setUp() throws Exception {

 		File file = new File(repository);

-		File configFile = new File(repository + "/axis2.xml");

+		File configFile = new File(repository + "/conf/axis2.xml");

 		if (!file.exists()) {

 			throw new Exception("repository directory "

 					+ file.getAbsolutePath() + " does not exists");

@@ -73,40 +83,32 @@
 	}

 

 	public void testEchoXMLASync() throws Exception {

-		KandulaDemoServiceStub	stub = new KandulaDemoServiceStub(

-				"target/initiator-repository",

-				new EndpointReference(

-						"http://localhost:8081/axis2/services/KandulaDemoService"));

 		TransactionManager tm = new TransactionManager(

 				Constants.WS_AT,

 				new EndpointReference(

-						"http://localhost:8081/axis2/services/ActivationCoordinator"));

-		tm.begin("target/initiator-repository",

-				"target/initiator-repository/axis2.xml", true);

-		try {

-			stub.creditOperation();

-		} catch (Exception e) {

-			tm.rollback();

-		}

-		tm.commit();

+						"http://localhost:8082/axis2/services/ActivationCoordinator"),

+				"target/initiator-repository",

+				"target/initiator-repository/axis2.xml");

+		tm.begin(false);

+		 

+		 stub.creditOperation();

+		 tm.commit();

+		Thread.sleep(5000);

+		

 	}

 

-	public void testEchoXMLSync() throws Exception {

-		KandulaDemoServiceStub stub = new KandulaDemoServiceStub(

-				"target/initiator-repository",

-				new EndpointReference(

-						"http://localhost:8081/axis2/services/KandulaDemoService"));

-		TransactionManager tm = new TransactionManager(

-				Constants.WS_AT,

-				new EndpointReference(

-						"http://localhost:8081/axis2/services/ActivationCoordinator"));

-		tm.begin("target/initiator-repository",

-				"target/initiator-repository/axis2.xml", false);

-		try {

-			stub.creditOperation();

-		} catch (Exception e) {

-			tm.rollback();

-		}

-		tm.commit();

-	}

-}

+//	public void testEchoXMLSync() throws Exception {

+//		// TransactionManager tm = new TransactionManager(

+//		// Constants.WS_AT,

+//		// new EndpointReference(

+//		// "http://localhost:8082/axis2/services/ActivationCoordinator"));

+//		// tm.begin("target/initiator-repository",

+//		// "target/initiator-repository/axis2.xml", false);

+//		// try {

+//		// stub.creditOperation();

+//		// } catch (Exception e) {

+//		// tm.rollback();

+//		// }

+//		// tm.commit();

+//	}

+}
\ No newline at end of file
diff --git a/test/org/apache/kandula/integration/KandulaDemoService.java b/test/org/apache/kandula/integration/KandulaDemoService.java
index a3432cd..ca88fa2 100644
--- a/test/org/apache/kandula/integration/KandulaDemoService.java
+++ b/test/org/apache/kandula/integration/KandulaDemoService.java
@@ -31,6 +31,18 @@
 	}
 
 	public OMElement creditOperation(OMElement element) {
-		return null;
+		element.build();
+		element.detach();
+//		System.out.println("done com");
+		return element;
 	}
+
+
+	public OMElement debitOperation(OMElement element) {
+		element.build();
+		element.detach();
+//		System.out.println("done com");
+		return element;
+	}
+
 }
\ No newline at end of file
diff --git a/test/org/apache/kandula/integration/KandulaDemoServiceStub.java b/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
index 74c5a28..cd76137 100644
--- a/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
+++ b/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
@@ -19,6 +19,7 @@
 import java.io.IOException;

 

 import org.apache.axiom.om.OMAbstractFactory;

+import org.apache.axiom.om.OMElement;

 import org.apache.axiom.soap.SOAPEnvelope;

 import org.apache.axiom.soap.SOAPFactory;

 import org.apache.axis2.AxisFault;

@@ -53,13 +54,7 @@
 

 	private static org.apache.axis2.description.AxisOperation[] operations;

 

-

-	/**

-	 * Constructor

-	 */

-	public KandulaDemoServiceStub(String axis2Home,

-			EndpointReference targetEndpoint) throws java.lang.Exception {

-		// creating the Service

+	{// creating the Service

 		_service = new AxisService("KandulaDemoService");

 

 		// creating the operations

@@ -70,6 +65,13 @@
 		operationDesc.setName(new javax.xml.namespace.QName("creditOperation"));

 		operations[0] = operationDesc;

 		_service.addOperation(operationDesc);

+	}

+

+	/**

+	 * Constructor

+	 */

+	public KandulaDemoServiceStub(String axis2Home,

+			EndpointReference targetEndpoint) throws java.lang.Exception {

 		this.toEPR = targetEndpoint;

 		// creating the configuration

 		configurationContext = ConfigurationContextFactory

@@ -83,7 +85,7 @@
 

 	}

 

-	public void creditOperation() throws IOException, AxisFault{

+	public void creditOperation() throws IOException, AxisFault {

 

 		Options options = new Options();

 		MessageContext messageContext = new MessageContext();

@@ -106,11 +108,37 @@
 

 	}

 

+	public void debitOperation() throws IOException, AxisFault {

+

+		Options options = new Options();

+		MessageContext messageContext = new MessageContext();

+		messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

+				AddressingConstants.Submission.WSA_NAMESPACE);

+		SOAPEnvelope env = createSOAPEnvelope();

+		messageContext.setEnvelope(env);

+

+		// _service.engageModule("addressing");

+

+		options.setAction("debitOperation");

+		options.setTo(this.toEPR);

+

+		// messageSender

+		// .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);

+		OperationClient client = operations[0].createClient(serviceContext,

+				options);

+		client.addMessageContext(messageContext);

+		client.execute(true);

+	}

+

 	private SOAPEnvelope createSOAPEnvelope() {

 

 		SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();

 		SOAPEnvelope env = factory.getDefaultEnvelope();

+//		SOAPBody body = factory.createSOAPBody();

+//		env.addChild(body);

+		OMElement test = factory.createOMElement("test","urn://temp", "tmp");

+		env.getBody().addChild(test);

 		return env;

 	}

 

-}
\ No newline at end of file
+}