You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ch...@apache.org on 2006/10/17 08:35:37 UTC
svn commit: r464827 [3/6] - in /webservices/sandesha/trunk/java:
interop/src/org/apache/sandesha2/interop/rm1_1_clients/
samples/src/sandesha2/samples/userguide/
src/org/apache/sandesha2/transport/ test/src/org/apache/sandesha2/
test/src/org/apache/san...
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoClient.java Mon Oct 16 23:35:33 2006
@@ -102,15 +102,14 @@
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
// clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Final.WSA_ANONYMOUS_URL));
-
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
-
// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
- clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
// clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+// serviceClient.engageModule(new QName ("sandesha2"));
+
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+
clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
clientOptions.setAction("urn:wsrm:EchoString");
@@ -118,23 +117,21 @@
//You must set the following two properties in the request-reply case.
clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
-
clientOptions.setUseSeparateListener(true);
serviceClient.setOptions(clientOptions);
- Callback callback1 = new TestCallback ("Callback 1");
- serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
-
- Callback callback2 = new TestCallback ("Callback 2");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
-
- Callback callback3 = new TestCallback ("Callback 3");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
-
- Callback callback4 = new TestCallback ("Callback 4");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
+// Callback callback1 = new TestCallback ("Callback 1");
+// serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
+//
+// Callback callback2 = new TestCallback ("Callback 2");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
+//
+// Callback callback3 = new TestCallback ("Callback 3");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
+//
+// Callback callback4 = new TestCallback ("Callback 4");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
Callback callback5 = new TestCallback ("Callback 5");
@@ -145,6 +142,9 @@
}
Thread.sleep(4000);
+
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
}
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java Mon Oct 16 23:35:33 2006
@@ -98,6 +98,7 @@
// String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
// clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
String sequenceKey = SandeshaUtil.getUUID(); //sequence key for thie sequence.
clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
@@ -106,8 +107,6 @@
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
@@ -191,7 +190,6 @@
}
public void onError (Exception e) {
- // TODO Auto-generated method stub
System.out.println("Error reported for test call back");
e.printStackTrace();
}
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncPingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncPingClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncPingClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/AsyncPingClient.java Mon Oct 16 23:35:33 2006
@@ -1,137 +1,135 @@
-/*
- * 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 sandesha2.samples.userguide;
-
-import java.io.File;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-
-public class AsyncPingClient {
-
- private static final String applicationNamespaceName = "http://tempuri.org/";
- private static final String ping = "ping";
- private static final String Text = "Text";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws AxisFault {
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
- new AsyncPingClient().run();
- }
-
- private void run () throws AxisFault {
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-// serviceClient.engageModule(new QName ("sandesha2"));
-
- Options clientOptions = new Options ();
-
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
-// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
-// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-
- clientOptions.setTo(new EndpointReference (toEPR));
-
- EndpointReference endpoint = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP);
- clientOptions.setProperty(SandeshaClientConstants.AcksTo,endpoint.getAddress());
-
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- clientOptions.setAction("urn:wsrm:Ping");
-
- String sequenceKey = "sequence2";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
- serviceClient.setOptions(clientOptions);
-
- serviceClient.fireAndForget(getPingOMBlock("ping1"));
- serviceClient.fireAndForget(getPingOMBlock("ping2"));
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- serviceClient.fireAndForget(getPingOMBlock("ping3"));
-
- boolean complete = false;
- while (!complete) {
- SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
- if (sequenceReport!=null && sequenceReport .getCompletedMessages().size()==3)
- complete = true;
- else {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- serviceClient.finalizeInvoke();
- }
-
- private static OMElement getPingOMBlock(String text) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement pingElem = fac.createOMElement(ping, namespace);
- OMElement textElem = fac.createOMElement(Text, namespace);
-
- textElem.setText(text);
- pingElem.addChild(textElem);
-
- return pingElem;
- }
-
-}
+/*
+ * 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 sandesha2.samples.userguide;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+
+public class AsyncPingClient {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String ping = "ping";
+ private static final String Text = "Text";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ new AsyncPingClient().run();
+ }
+
+ private void run () throws AxisFault {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+// serviceClient.engageModule(new QName ("sandesha2"));
+
+ Options clientOptions = new Options ();
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ EndpointReference endpoint = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP);
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,endpoint.getAddress());
+
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setAction("urn:wsrm:Ping");
+
+ String sequenceKey = "sequence2";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ boolean complete = false;
+ while (!complete) {
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport .getCompletedMessages().size()==3)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+}
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/MTOMPingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/MTOMPingClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/MTOMPingClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/MTOMPingClient.java Mon Oct 16 23:35:33 2006
@@ -1,152 +1,149 @@
-/*
- * 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 sandesha2.samples.userguide;
-
-import java.io.File;
-
-import javax.activation.DataHandler;
-import javax.activation.FileDataSource;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SandeshaListener;
-import org.apache.sandesha2.client.SequenceReport;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class MTOMPingClient {
-
- private static final String applicationNamespaceName = "http://tempuri.org/";
- private static final String MTOMPing = "MTOMPing";
- private static final String Text = "Text";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8080";
- private String transportToPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
- private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws AxisFault {
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
- new MTOMPingClient ().run();
- }
-
- private void run () throws AxisFault {
-
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- Options clientOptions = new Options ();
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
- clientOptions.setTo(new EndpointReference (toEPR));
-
- String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
- clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
-// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-
-// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
-
- clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
- ServiceClient serviceClient = new ServiceClient (configContext,null);
- serviceClient.engageModule(new QName ("sandesha2"));
-
- clientOptions.setAction("urn:wsrm:Ping");
- serviceClient.setOptions(clientOptions);
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-
- serviceClient.fireAndForget(getPingOMBlock());
- SandeshaClient.waitUntilSequenceCompleted(serviceClient);
-
- serviceClient.finalizeInvoke();
- }
-
- private static OMElement getPingOMBlock() throws AxisFault {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement pingElem = fac.createOMElement(MTOMPing, namespace);
- OMElement attachmentElem = fac.createOMElement("Attachment", namespace);
-
- String imageName = "test-resources" + File.separator + "mtom-image.jpg";
- FileDataSource dataSource;
- try {
- dataSource = new FileDataSource (new File (imageName));
- } catch (Exception e) {
- throw new AxisFault (e);
- }
-
- DataHandler dataHandler = new DataHandler(dataSource);
-
- OMText textData = fac.createOMText(dataHandler, true);
- attachmentElem.addChild(textData);
-
- pingElem.addChild(attachmentElem);
-
- return pingElem;
- }
-
- private class SandeshaListenerImpl implements SandeshaListener {
-
- public void onError(AxisFault fault) {
- System.out.println("*********** RM fault callbak called");
- }
-
- public void onTimeOut(SequenceReport report) {
- System.out.println("Sequence timed out");
- }
- }
-
-}
-
+/*
+ * 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 sandesha2.samples.userguide;
+
+import java.io.File;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SandeshaListener;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class MTOMPingClient {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String MTOMPing = "MTOMPing";
+ private static final String Text = "Text";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8080";
+ private String transportToPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+ private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ new MTOMPingClient ().run();
+ }
+
+ private void run () throws AxisFault {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ Options clientOptions = new Options ();
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+
+ clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+ serviceClient.engageModule(new QName ("sandesha2"));
+
+ clientOptions.setAction("urn:wsrm:Ping");
+ serviceClient.setOptions(clientOptions);
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+
+ serviceClient.fireAndForget(getPingOMBlock());
+ SandeshaClient.waitUntilSequenceCompleted(serviceClient);
+
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock() throws AxisFault {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(MTOMPing, namespace);
+ OMElement attachmentElem = fac.createOMElement("Attachment", namespace);
+
+ String imageName = "test-resources" + File.separator + "mtom-image.jpg";
+ FileDataSource dataSource;
+ try {
+ dataSource = new FileDataSource (new File (imageName));
+ } catch (Exception e) {
+ throw new AxisFault (e);
+ }
+
+ DataHandler dataHandler = new DataHandler(dataSource);
+
+ OMText textData = fac.createOMText(dataHandler, true);
+ attachmentElem.addChild(textData);
+
+ pingElem.addChild(attachmentElem);
+
+ return pingElem;
+ }
+
+ private class SandeshaListenerImpl implements SandeshaListener {
+
+ public void onError(AxisFault fault) {
+ System.out.println("*********** RM fault callbak called");
+ }
+
+ public void onTimeOut(SequenceReport report) {
+ System.out.println("Sequence timed out");
+ }
+ }
+
+}
+
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncEchoClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncEchoClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncEchoClient.java Mon Oct 16 23:35:33 2006
@@ -95,11 +95,8 @@
clientOptions.setAction("urn:wsrm:EchoString");
// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-
// clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
serviceClient.setOptions(clientOptions);
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncPingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncPingClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncPingClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/SyncPingClient.java Mon Oct 16 23:35:33 2006
@@ -1,154 +1,154 @@
-/*
- * 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 sandesha2.samples.userguide;
-
-import java.io.File;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SandeshaListener;
-import org.apache.sandesha2.client.SequenceReport;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-
-public class SyncPingClient {
-
- private static final String applicationNamespaceName = "http://tempuri.org/";
- private static final String ping = "ping";
- private static final String Text = "Text";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8080";
- private String transportToPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
- private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws AxisFault {
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
-
- new SyncPingClient ().run();
- }
-
- private void run () throws AxisFault {
-
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- Options clientOptions = new Options ();
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
- clientOptions.setTo(new EndpointReference (toEPR));
-
- String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
-// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
-// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-
-// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
-
- clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-// serviceClient.engageModule(new QName ("sandesha2"));
-
- clientOptions.setAction("urn:wsrm:Ping");
- serviceClient.setOptions(clientOptions);
-
- serviceClient.fireAndForget(getPingOMBlock("ping1"));
- serviceClient.fireAndForget(getPingOMBlock("ping2"));
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
-
- serviceClient.fireAndForget(getPingOMBlock("ping3"));
-
- SequenceReport sequenceReport = null;
-
- boolean complete = false;
- while (!complete) {
- sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
- if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
- complete = true;
- else {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
-
- serviceClient.finalizeInvoke();
- }
-
- private static OMElement getPingOMBlock(String text) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement pingElem = fac.createOMElement(ping, namespace);
- OMElement textElem = fac.createOMElement(Text, namespace);
-
- textElem.setText(text);
- pingElem.addChild(textElem);
-
- return pingElem;
- }
-
- private class SandeshaListenerImpl implements SandeshaListener {
-
- public void onError(AxisFault fault) {
- System.out.println("*********** RM fault callbak called");
- }
-
- public void onTimeOut(SequenceReport report) {
- System.out.println("Sequence timed out");
- }
- }
-
-}
+/*
+ * 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 sandesha2.samples.userguide;
+
+import java.io.File;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SandeshaListener;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+
+public class SyncPingClient {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String ping = "ping";
+ private static final String Text = "Text";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8080";
+ private String transportToPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+ private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+
+ new SyncPingClient ().run();
+ }
+
+ private void run () throws AxisFault {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ Options clientOptions = new Options ();
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = SandeshaUtil.getUUID();// "sequence2";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+
+// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+// clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+
+ clientOptions.setProperty(SandeshaClientConstants.SANDESHA_LISTENER, new SandeshaListenerImpl ());
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+// serviceClient.engageModule(new QName ("sandesha2"));
+
+ clientOptions.setAction("urn:wsrm:Ping");
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ SequenceReport sequenceReport = null;
+
+ boolean complete = false;
+ while (!complete) {
+ sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ if (sequenceReport!=null && sequenceReport.getCompletedMessages().size()==3)
+ complete = true;
+ else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+ private class SandeshaListenerImpl implements SandeshaListener {
+
+ public void onError(AxisFault fault) {
+ System.out.println("*********** RM fault callbak called");
+ }
+
+ public void onTimeOut(SequenceReport report) {
+ System.out.println("Sequence timed out");
+ }
+ }
+
+}
Modified: webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/UserguidePingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/UserguidePingClient.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/UserguidePingClient.java (original)
+++ webservices/sandesha/trunk/java/samples/src/sandesha2/samples/userguide/UserguidePingClient.java Mon Oct 16 23:35:33 2006
@@ -1,75 +1,75 @@
-/*
- * 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 sandesha2.samples.userguide;
-
-import java.io.File;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-
-
-public class UserguidePingClient {
-
- private static final String applicationNamespaceName = "http://tempuri.org/";
- private static final String ping = "ping";
- private static final String Text = "Text";
- private static String toEPR = "http://127.0.0.1:8070/axis2/services/RMSampleService";
-
- private static String CLIENT_REPO_PATH = "Full path to the Client Repo folder";
-
- public static void main(String[] args) throws AxisFault {
-
- String axis2_xml = CLIENT_REPO_PATH + File.separator + "client_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
-
- Options clientOptions = new Options ();
- clientOptions.setTo(new EndpointReference (toEPR));
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
- clientOptions.setAction("urn:wsrm:Ping");
- serviceClient.setOptions(clientOptions);
-
- serviceClient.fireAndForget(getPingOMBlock("ping1"));
- serviceClient.fireAndForget(getPingOMBlock("ping2"));
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- serviceClient.fireAndForget(getPingOMBlock("ping3"));
-
- serviceClient.finalizeInvoke();
- }
-
- private static OMElement getPingOMBlock(String text) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement pingElem = fac.createOMElement(ping, namespace);
- OMElement textElem = fac.createOMElement(Text, namespace);
-
- textElem.setText(text);
- pingElem.addChild(textElem);
-
- return pingElem;
- }
-}
+/*
+ * 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 sandesha2.samples.userguide;
+
+import java.io.File;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+
+
+public class UserguidePingClient {
+
+ private static final String applicationNamespaceName = "http://tempuri.org/";
+ private static final String ping = "ping";
+ private static final String Text = "Text";
+ private static String toEPR = "http://127.0.0.1:8070/axis2/services/RMSampleService";
+
+ private static String CLIENT_REPO_PATH = "Full path to the Client Repo folder";
+
+ public static void main(String[] args) throws AxisFault {
+
+ String axis2_xml = CLIENT_REPO_PATH + File.separator + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);
+
+ Options clientOptions = new Options ();
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+ clientOptions.setAction("urn:wsrm:Ping");
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ serviceClient.fireAndForget(getPingOMBlock("ping3"));
+
+ serviceClient.cleanup();
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+}
Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/transport/Sandesha2TransportSender.java Mon Oct 16 23:35:33 2006
@@ -95,4 +95,6 @@
public void init(HandlerDescription handlerdesc) {}
+ public void flowComplete(MessageContext msgContext) {}
+
}
Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageContextPropertyTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageContextPropertyTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageContextPropertyTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageContextPropertyTest.java Mon Oct 16 23:35:33 2006
@@ -136,7 +136,8 @@
assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
- serviceClient.finalizeInvoke();
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
}
private OMElement getTestOperationOMBlock(String text) {
Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageRetransmissionTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageRetransmissionTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageRetransmissionTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/MessageRetransmissionTest.java Mon Oct 16 23:35:33 2006
@@ -1,156 +1,157 @@
-/*
- * 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 org.apache.sandesha2;
-
-import java.io.File;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-
-public class MessageRetransmissionTest extends SandeshaTestCase {
-
- SimpleHTTPServer httpServer = null;
- private final String applicationNamespaceName = "http://tempuri.org/";
- private final String ping = "ping";
- private final String Text = "Text";
-
- private Log log = LogFactory.getLog(getClass());
-
- int serverPort = DEFAULT_SERVER_TEST_PORT;
-
- public MessageRetransmissionTest () {
- super ("MessageRetransmissionTest");
- }
-
- public void setUp () throws AxisFault {
- String serverPortStr = getTestProperty("test.server.port");
- if (serverPortStr!=null) {
-
- try {
- serverPort = Integer.parseInt(serverPortStr);
- } catch (NumberFormatException e) {
- log.error(e);
- }
- }
- }
-
- private void startServer () throws AxisFault {
-
- String repoPath = "target" + File.separator + "repos" + File.separator + "server";
- String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
-
- httpServer = new SimpleHTTPServer (configContext,serverPort);
- httpServer.start();
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- throw new SandeshaException ("sleep interupted");
- }
- }
-
- public void testMessageRetransmission () throws AxisFault,InterruptedException {
-
- String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
- String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-
- String repoPath = "target" + File.separator + "repos" + File.separator + "client";
- String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
- //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- Options clientOptions = new Options ();
- clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-
- clientOptions.setTo(new EndpointReference (to));
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-
- String sequenceKey = "sequence1";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
- //serviceClient.
-
- serviceClient.setOptions(clientOptions);
-
- serviceClient.fireAndForget(getPingOMBlock("ping1"));
-// serviceClient.fireAndForget(getPingOMBlock("ping2"));
-
- //starting the server after a wait
- Thread.sleep(10000);
-
- startServer();
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- serviceClient.fireAndForget(getPingOMBlock("ping2"));
-
-
- Thread.sleep(10000);
-
- SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
- assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
- assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
- assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
- assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
-
- serviceClient.finalizeInvoke();
- }
-
- private OMElement getPingOMBlock(String text) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement pingElem = fac.createOMElement(ping, namespace);
- OMElement textElem = fac.createOMElement(Text, namespace);
-
- textElem.setText(text);
- pingElem.addChild(textElem);
-
- return pingElem;
- }
-
- public void tearDown () throws SandeshaException {
- if (httpServer!=null)
- httpServer.stop();
-
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- throw new SandeshaException ("sleep interupted");
- }
- }
-
-}
+/*
+ * 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 org.apache.sandesha2;
+
+import java.io.File;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+
+public class MessageRetransmissionTest extends SandeshaTestCase {
+
+ SimpleHTTPServer httpServer = null;
+ private final String applicationNamespaceName = "http://tempuri.org/";
+ private final String ping = "ping";
+ private final String Text = "Text";
+
+ private Log log = LogFactory.getLog(getClass());
+
+ int serverPort = DEFAULT_SERVER_TEST_PORT;
+
+ public MessageRetransmissionTest () {
+ super ("MessageRetransmissionTest");
+ }
+
+ public void setUp () throws AxisFault {
+ String serverPortStr = getTestProperty("test.server.port");
+ if (serverPortStr!=null) {
+
+ try {
+ serverPort = Integer.parseInt(serverPortStr);
+ } catch (NumberFormatException e) {
+ log.error(e);
+ }
+ }
+ }
+
+ private void startServer () throws AxisFault {
+
+ String repoPath = "target" + File.separator + "repos" + File.separator + "server";
+ String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+
+ httpServer = new SimpleHTTPServer (configContext,serverPort);
+ httpServer.start();
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+ }
+
+ public void testMessageRetransmission () throws AxisFault,InterruptedException {
+
+ String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+ String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+
+ String repoPath = "target" + File.separator + "repos" + File.separator + "client";
+ String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+ //clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ Options clientOptions = new Options ();
+ clientOptions.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+ clientOptions.setTo(new EndpointReference (to));
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+
+ String sequenceKey = "sequence1";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+ //serviceClient.
+
+ serviceClient.setOptions(clientOptions);
+
+ serviceClient.fireAndForget(getPingOMBlock("ping1"));
+// serviceClient.fireAndForget(getPingOMBlock("ping2"));
+
+ //starting the server after a wait
+ Thread.sleep(10000);
+
+ startServer();
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ serviceClient.fireAndForget(getPingOMBlock("ping2"));
+
+
+ Thread.sleep(10000);
+
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+ assertTrue(sequenceReport.getCompletedMessages().contains(new Long(1)));
+ assertTrue(sequenceReport.getCompletedMessages().contains(new Long(2)));
+ assertEquals(sequenceReport.getSequenceStatus(),SequenceReport.SEQUENCE_STATUS_TERMINATED);
+ assertEquals(sequenceReport.getSequenceDirection(),SequenceReport.SEQUENCE_DIRECTION_OUT);
+
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
+ private OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement pingElem = fac.createOMElement(ping, namespace);
+ OMElement textElem = fac.createOMElement(Text, namespace);
+
+ textElem.setText(text);
+ pingElem.addChild(textElem);
+
+ return pingElem;
+ }
+
+ public void tearDown () throws SandeshaException {
+ if (httpServer!=null)
+ httpServer.stop();
+
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+ }
+
+}
Modified: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java?view=diff&rev=464827&r1=464826&r2=464827
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java (original)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/SandeshaClientTest.java Mon Oct 16 23:35:33 2006
@@ -1,159 +1,160 @@
-/*
- * 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 org.apache.sandesha2;
-
-import java.io.File;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sandesha2.client.SandeshaClient;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.client.SequenceReport;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class SandeshaClientTest extends SandeshaTestCase {
-
- SimpleHTTPServer httpServer = null;
- private Log log = LogFactory.getLog(getClass());
- int serverPort = DEFAULT_SERVER_TEST_PORT;
-
- public SandeshaClientTest () {
- super ("SandeshaClientTest");
- }
-
- public void setUp () throws AxisFault {
-
- String repoPath = "target" + File.separator + "repos" + File.separator + "server";
- String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
-
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
- String serverPortStr = getTestProperty("test.server.port");
- if (serverPortStr!=null) {
-
- try {
- serverPort = Integer.parseInt(serverPortStr);
- } catch (NumberFormatException e) {
- log.error(e);
- }
- }
-
- httpServer = new SimpleHTTPServer (configContext,serverPort);
- httpServer.start();
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- throw new SandeshaException ("sleep interupted");
- }
- }
-
- public void tearDown () throws SandeshaException {
- if (httpServer!=null)
- httpServer.stop();
-
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- throw new SandeshaException ("sleep interupted");
- }
- }
-
- public void testCreateSequenceWithOffer () throws AxisFault,InterruptedException {
-
- String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
- String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
-
- String repoPath = "target" + File.separator + "repos" + File.separator + "client";
- String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
-
- Options clientOptions = new Options ();
-
- clientOptions.setTo(new EndpointReference (to));
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
-
- String sequenceKey = SandeshaUtil.getUUID();
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-
- String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
- clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
- String offeredSequenceID = SandeshaUtil.getUUID();
- clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequenceID);
-
- serviceClient.setOptions(clientOptions);
- //serviceClient.
-
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- clientOptions.setUseSeparateListener(true);
-
- serviceClient.setOptions(clientOptions);
-
- SandeshaClient.createSequence(serviceClient,true);
-
- Thread.sleep(10000);
-
- SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
-
- assertNotNull(sequenceReport.getSequenceID());
- assertFalse(sequenceReport.isSecureSequence());
-
- serviceClient.finalizeInvoke();
- }
-
-// public void testCreateSequenceWithoutOffer () {
-//// SandeshaClient.createSequence(serviceClient,true);
-//
-//
-// }
-
-// public void testCreateSequenceWithSequenceKey () {
-//
-// }
-//
-// public void testTerminateSequence () {
-//
-// }
-//
-// public void testCloseSequence () {
-//
-// }
-//
-// public void testAckRequest () {
-//
-// }
-//
-// public void getSequenceIDTest () {
-//
-// }
-
-
-}
+/*
+ * 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 org.apache.sandesha2;
+
+import java.io.File;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.client.SandeshaClient;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.client.SequenceReport;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class SandeshaClientTest extends SandeshaTestCase {
+
+ SimpleHTTPServer httpServer = null;
+ private Log log = LogFactory.getLog(getClass());
+ int serverPort = DEFAULT_SERVER_TEST_PORT;
+
+ public SandeshaClientTest () {
+ super ("SandeshaClientTest");
+ }
+
+ public void setUp () throws AxisFault {
+
+ String repoPath = "target" + File.separator + "repos" + File.separator + "server";
+ String axis2_xml = "target" + File.separator + "repos" + File.separator + "server" + File.separator + "server_axis2.xml";
+
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+ String serverPortStr = getTestProperty("test.server.port");
+ if (serverPortStr!=null) {
+
+ try {
+ serverPort = Integer.parseInt(serverPortStr);
+ } catch (NumberFormatException e) {
+ log.error(e);
+ }
+ }
+
+ httpServer = new SimpleHTTPServer (configContext,serverPort);
+ httpServer.start();
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+ }
+
+ public void tearDown () throws SandeshaException {
+ if (httpServer!=null)
+ httpServer.stop();
+
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ throw new SandeshaException ("sleep interupted");
+ }
+ }
+
+ public void testCreateSequenceWithOffer () throws AxisFault,InterruptedException {
+
+ String to = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+ String transportTo = "http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService";
+
+ String repoPath = "target" + File.separator + "repos" + File.separator + "client";
+ String axis2_xml = "target" + File.separator + "repos" + File.separator + "client" + File.separator + "client_axis2.xml";
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repoPath,axis2_xml);
+
+ Options clientOptions = new Options ();
+
+ clientOptions.setTo(new EndpointReference (to));
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportTo);
+
+ String sequenceKey = SandeshaUtil.getUUID();
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+ String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+ String offeredSequenceID = SandeshaUtil.getUUID();
+ clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,offeredSequenceID);
+
+ serviceClient.setOptions(clientOptions);
+ //serviceClient.
+
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+
+ serviceClient.setOptions(clientOptions);
+
+ SandeshaClient.createSequence(serviceClient,true);
+
+ Thread.sleep(10000);
+
+ SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
+
+ assertNotNull(sequenceReport.getSequenceID());
+ assertFalse(sequenceReport.isSecureSequence());
+
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
+ }
+
+// public void testCreateSequenceWithoutOffer () {
+//// SandeshaClient.createSequence(serviceClient,true);
+//
+//
+// }
+
+// public void testCreateSequenceWithSequenceKey () {
+//
+// }
+//
+// public void testTerminateSequence () {
+//
+// }
+//
+// public void testCloseSequence () {
+//
+// }
+//
+// public void testAckRequest () {
+//
+// }
+//
+// public void getSequenceIDTest () {
+//
+// }
+
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org