Author: chamikara
Date: Sun Dec 4 02:43:28 2005
New Revision: 353845
URL: http://svn.apache.org/viewcvs?rev=353845&view=rev
Log:
changed the package of Sample files
Added:
webservices/sandesha/trunk/samples/src/sandesha2/
webservices/sandesha/trunk/samples/src/sandesha2/samples/
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/RMInteropService.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
Removed:
webservices/sandesha/trunk/samples/src/org/
Modified:
webservices/sandesha/trunk/samples/conf/interop/services.xml
Modified: webservices/sandesha/trunk/samples/conf/interop/services.xml
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/conf/interop/services.xml?rev=353845&r1=353844&r2=353845&view=diff
==============================================================================
--- webservices/sandesha/trunk/samples/conf/interop/services.xml (original)
+++ webservices/sandesha/trunk/samples/conf/interop/services.xml Sun Dec 4
02:43:28 2005
@@ -1,7 +1,7 @@
<service name="RMInteropService">
- <parameter name="ServiceClass"
locked="xsd:false">org.apache.sandesha2.samples.interop.service.RMInteropService</parameter>
+ <parameter name="ServiceClass"
locked="xsd:false">sandesha2.samples.interop.RMInteropService</parameter>
- <module ref="sandesha"/>
+ <module ref="Sandesha2-0.9"/>
<description>
This is a testing service , to test the system is working or not
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncEchoClient.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +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 sandesha2.samples.interop;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Sandesha2ClientAPI;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class AsyncEchoClient {
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String ackIP = "127.0.0.1";
+
+ private String ackPort = "9070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort +
"/axis2/services/RMInteropService";
+
+ private String acksToEPR = "http://" + ackIP + ":" + ackPort +
"/axis2/services/AnonymousService/echoString";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change
this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\"; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String sandesha2HomeDir = null;
+ if (args!=null && args.length>0)
+ sandesha2HomeDir = args[0];
+
+ if (sandesha2HomeDir!=null && !"".equals(sandesha2HomeDir)) {
+ SANDESHA2_HOME = sandesha2HomeDir;
+ AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\";
+ }
+
+ new AsyncEchoClient ().run();
+ }
+
+ private void run () throws Exception {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please set the directory you
unzipped Sandesha2 as the first option.");
+ return;
+ }
+
+ Call call = new Call(AXIS2_CLIENT_PATH);
+ call.engageModule(new QName("Sandesha2-0.9"));
+ Options clientOptions = new Options ();
+ clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean
(true));
+ call.setClientOptions(clientOptions);
+
+ //You must set the following two properties in the
request-reply case.
+
clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+
+ clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
+
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ clientOptions.setTo(new EndpointReference(toEPR));
+
clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,toEPR);
+
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
//Optional
+ clientOptions.setSoapAction("test:soap:action");
+
clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
//Optional
+ Callback callback1 = new TestCallback ("Callback 1");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo1"),callback1);
+ Callback callback2 = new TestCallback ("Callback 2");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo2"),callback2);
+ clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE,
"true");
+ Callback callback3 = new TestCallback ("Callback 3");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo3"),callback3);
+
+ while (!callback3.isComplete()) {
+ Thread.sleep(1000);
+ }
+
+ call.close();
+ }
+
+ private static OMElement getEchoOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace defaultNS =
fac.createOMNamespace("http://tempuri.apache.org","ns1");
+ OMElement echoElement = fac.createOMElement("echoString", null);
+ OMElement paramElement = fac.createOMElement("text", null);
+ echoElement.addChild(paramElement);
+ paramElement.setText(text);
+
+ return echoElement;
+ }
+
+ class TestCallback extends Callback {
+
+ String name = null;
+
+ public TestCallback (String name) {
+ this.name = name;
+ }
+
+ public void onComplete(AsyncResult result) {
+ //System.out.println("On Complete Called for " + text);
+ OMElement responseElement =
result.getResponseEnvelope().getBody().getFirstElement();
+ if (responseElement==null) {
+ System.out.println("Response element is null");
+ return;
+ }
+
+ String tempText = responseElement.getText();
+ if (tempText==null || "".equals(tempText)){
+ OMElement child =
responseElement.getFirstElement();
+ if (child!=null)
+ tempText = child.getText();
+ }
+
+
+ tempText = (tempText==null)?"":tempText;
+
+ System.out.println("Callback '" + name + "' got
result:" + tempText);
+
+ }
+
+ public void reportError(Exception e) {
+ // TODO Auto-generated method stub
+ System.out.println("Error reported for test call back");
+ e.printStackTrace();
+ }
+ }
+
+
+}
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/AsyncPingClient.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +1,98 @@
+/*
+ * 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.interop;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.MessageSender;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Sandesha2ClientAPI;
+
+
+public class AsyncPingClient {
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String ackIP = "127.0.0.1";
+
+ private String ackPort = "9070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort +
"/axis2/services/RMInteropService";
+
+ private String acksToEPR = "http://" + ackIP + ":" + ackPort +
"/axis2/services/AnonymousService/echoString";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change
this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\"; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String sandesha2HomeDir = null;
+ if (args!=null && args.length>0)
+ sandesha2HomeDir = args[0];
+
+ if (sandesha2HomeDir!=null && !"".equals(sandesha2HomeDir)) {
+ SANDESHA2_HOME = sandesha2HomeDir;
+ AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\";
+ }
+
+ new AsyncPingClient().run();
+ }
+
+ public void run () throws AxisFault {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change
<SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
+ Options clientOptions = new Options ();
+ clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean
(true));
+ sender.setClientOptions(clientOptions);
+
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ clientOptions.setProperty(Sandesha2ClientAPI.AcksTo,acksToEPR);
+ sender.engageModule(new QName ("Sandesha2-0.9"));
+ clientOptions.setTo(new EndpointReference(toEPR));
+
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
+ sender.send("ping",getPingOMBlock("ping1"));
+ sender.send("ping",getPingOMBlock("ping2"));
+ clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE,
"true");
+ sender.send("ping",getPingOMBlock("ping3"));
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace ns =
fac.createOMNamespace("http://tempuri.apache.org",
+ "ns1");
+ OMElement pingElement = fac.createOMElement("ping", ns);
+ OMElement paramElement = fac.createOMElement("param1", ns);
+ pingElement.addChild(paramElement);
+ paramElement.setText(text);
+
+ return pingElement;
+ }
+
+}
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/RMInteropService.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/RMInteropService.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/RMInteropService.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/RMInteropService.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 1999-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 sandesha2.samples.interop;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+
+/**
+ * @author
+ */
+public class RMInteropService {
+
+ private static Map sequences = new HashMap();
+
+ public OMElement echoString(OMElement in) {
+
+ String responseText = null;
+ if (in != null) {
+ String tempText = in.getText();
+ if (tempText == null || "".equals(tempText)) {
+ OMElement firstChild = in.getFirstElement();
+ if (firstChild != null)
+ tempText = firstChild.getText();
+ }
+
+ if (tempText != null)
+ responseText = tempText;
+ }
+
+ System.out.println("echoString got text:"
+ + ((null == responseText) ? "" : responseText));
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/",
+ "echoString");
+ OMElement method = fac.createOMElement("echoStringResponse",
omNs);
+
+ OMElement value = fac.createOMElement("text", omNs);
+
+ if (responseText == null || "".equals(responseText))
+ responseText = "echo response";
+
+ value.setText(responseText);
+ method.addChild(value);
+
+ return method;
+ }
+
+ public void ping(OMElement in) {
+ //Just accept the message and do some processing
+
+ String text = null;
+ if (in != null) {
+ OMElement firstElement = in.getFirstElement();
+ if (firstElement != null) {
+ text = firstElement.getText();
+ }
+ }
+
+ text = (text == null) ? "" : text;
+
+ System.out.println("Ping got text:" + text);
+ }
+
+ public OMElement EchoString(OMElement in) {
+
+ String responseText = null;
+ if (in != null) {
+ String tempText = in.getText();
+ if (tempText == null || "".equals(tempText)) {
+ OMElement firstChild = in.getFirstElement();
+ if (firstChild != null)
+ tempText = firstChild.getText();
+ }
+
+ if (tempText != null)
+ responseText = tempText;
+ }
+
+ System.out.println("echoString got text:"
+ + ((null == responseText) ? "" : responseText));
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/",
+ "echoString");
+ OMElement method = fac.createOMElement("echoStringResponse",
omNs);
+
+ OMElement value = fac.createOMElement("text", omNs);
+
+ if (responseText == null || "".equals(responseText))
+ responseText = "echo response";
+
+ value.setText(responseText);
+ method.addChild(value);
+
+ return method;
+ }
+
+ public void Ping(OMElement in) {
+ //Just accept the message and do some processing
+
+ String text = null;
+ if (in != null) {
+ OMElement firstElement = in.getFirstElement();
+ if (firstElement != null) {
+ text = firstElement.getText();
+ }
+ }
+
+ text = (text == null) ? "" : text;
+
+ System.out.println("Ping got text:" + text);
+ }
+
+}
\ No newline at end of file
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncEchoClient.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +1,142 @@
+/*
+ * 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.interop;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Sandesha2ClientAPI;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class SyncEchoClient {
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort +
"/axis2/services/RMInteropService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change
this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\"; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String sandesha2HomeDir = null;
+ if (args!=null && args.length>0)
+ sandesha2HomeDir = args[0];
+
+ if (sandesha2HomeDir!=null && !"".equals(sandesha2HomeDir)) {
+ SANDESHA2_HOME = sandesha2HomeDir;
+ AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\";
+ }
+
+ new SyncEchoClient().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;
+ }
+
+ Call call = new Call(AXIS2_CLIENT_PATH);
+ call.engageModule(new QName("Sandesha2-0.9"));
+ Options clientOptions = new Options ();
+ clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean
(true));
+
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ call.setClientOptions(clientOptions);
+
+ //You must set the following two properties in the
request-reply case.
+
clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+
+ clientOptions.setTo(new EndpointReference(toEPR));
+
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
+
clientOptions.setProperty(Sandesha2ClientAPI.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID());
+ Callback callback1 = new TestCallback ("Callback 1");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo1"),callback1);
+ Callback callback2 = new TestCallback ("Callback 2");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo2"),callback2);
+ clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE,
"true");
+ Callback callback3 = new TestCallback ("Callback 3");
+ call.invokeNonBlocking("echoString",
getEchoOMBlock("echo3"),callback3);
+ }
+
+ private static OMElement getEchoOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace defaultNS =
fac.createOMNamespace("http://tempuri.apache.org","ns1");
+ OMElement echoElement = fac.createOMElement("echoString",
defaultNS);
+ OMElement paramElement = fac.createOMElement("text", defaultNS);
+ echoElement.addChild(paramElement);
+ paramElement.setText(text);
+
+ return echoElement;
+ }
+
+ private class TestCallback extends Callback {
+
+ String name = null;
+
+ public TestCallback (String name) {
+ this.name = name;
+ }
+
+ public String toString () {
+ return name;
+ }
+
+ public void onComplete(AsyncResult result) {
+ //System.out.println("On Complete Called for " + text);
+ OMElement responseElement =
result.getResponseEnvelope().getBody().getFirstElement();
+ if (responseElement==null) {
+ System.out.println("Response element is null");
+ return;
+ }
+
+ String tempText = responseElement.getText();
+ if (tempText==null || "".equals(tempText)){
+ OMElement child =
responseElement.getFirstElement();
+ if (child!=null)
+ tempText = child.getText();
+ }
+
+
+ tempText = (tempText==null)?"":tempText;
+
+ System.out.println("Callback '" + name + "' got
result:" + tempText);
+
+ }
+
+ public void reportError(Exception e) {
+ // TODO Auto-generated method stub
+ System.out.println("Error reported for test call back");
+ }
+ }
+
+}
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/interop/SyncPingClient.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.interop;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.MessageSender;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.Sandesha2ClientAPI;
+
+
+public class SyncPingClient {
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort +
"/axis2/services/RMInteropService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change
this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\"; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String sandesha2HomeDir = null;
+ if (args!=null && args.length>0)
+ sandesha2HomeDir = args[0];
+
+ if (sandesha2HomeDir!=null && !"".equals(sandesha2HomeDir)) {
+ SANDESHA2_HOME = sandesha2HomeDir;
+ AXIS2_CLIENT_PATH = SANDESHA2_HOME +
"\\target\\repos\\client\\";
+ }
+
+
+ new SyncPingClient ().run();
+ }
+
+ public void run () throws AxisFault {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change
<SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
+ sender.engageModule(new QName ("Sandesha2-0.9"));
+ Options clientOptions = new Options ();
+ sender.setClientOptions(clientOptions);
+ clientOptions.setProperty(Options.COPY_PROPERTIES,new Boolean
(true));
+
clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+ clientOptions.setTo(new EndpointReference(toEPR));
+
clientOptions.setProperty(Sandesha2ClientAPI.SEQUENCE_KEY,"sequence1");
+ sender.send("ping",getPingOMBlock("ping1"));
+ sender.send("ping",getPingOMBlock("ping2"));
+ clientOptions.setProperty(Sandesha2ClientAPI.LAST_MESSAGE,
"true");
+ sender.send("ping",getPingOMBlock("ping3"));
+
+ }
+
+ private static OMElement getPingOMBlock(String text) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace ns =
fac.createOMNamespace("http://tempuri.apache.org",
+ "ns1");
+ OMElement pingElement = fac.createOMElement("ping", ns);
+ OMElement paramElement = fac.createOMElement("param1", ns);
+ pingElement.addChild(paramElement);
+ paramElement.setText(text);
+
+ return pingElement;
+ }
+
+}
Added:
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
URL:
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java?rev=353845&view=auto
==============================================================================
---
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
(added)
+++
webservices/sandesha/trunk/samples/src/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
Sun Dec 4 02:43:28 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.simpleServer;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+public class SimpleSandesha2Server {
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change
this to ur path.
+
+ private static String AXIS2_SERVER_PATH = SANDESHA2_HOME +
"\\target\\repos\\server\\"; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+ String sandesha2HomeDir = null;
+ if (args!=null && args.length>0)
+ sandesha2HomeDir = args[0];
+
+ if (sandesha2HomeDir!=null && !"".equals(sandesha2HomeDir))
+ SANDESHA2_HOME = sandesha2HomeDir;
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change
<SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ System.out.println("Starting sandesha2 server...");
+ SimpleHTTPServer server = new SimpleHTTPServer
(AXIS2_SERVER_PATH,8080);
+ server.start();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]