Author: chamikara
Date: Sun Oct 30 21:34:11 2005
New Revision: 329754

URL: http://svn.apache.org/viewcvs?rev=329754&view=rev
Log:
Rearranged InteropSample service and the clients

Added:
    webservices/sandesha/trunk/samples/conf/
    webservices/sandesha/trunk/samples/conf/interop/
    webservices/sandesha/trunk/samples/conf/interop/services.xml
    webservices/sandesha/trunk/samples/src/
    webservices/sandesha/trunk/samples/src/org/
    webservices/sandesha/trunk/samples/src/org/apache/
    webservices/sandesha/trunk/samples/src/org/apache/sandesha2/
    webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/
    webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncEchoClient.java
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncPingClient.java
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncEchoClient.java
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncPingClient.java
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/service/
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/service/RMInteropService.java
    webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/
    
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/SimpleSandesha2Server.java
Removed:
    webservices/sandesha/trunk/samples/interop/

Added: webservices/sandesha/trunk/samples/conf/interop/services.xml
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/conf/interop/services.xml?rev=329754&view=auto
==============================================================================
--- webservices/sandesha/trunk/samples/conf/interop/services.xml (added)
+++ webservices/sandesha/trunk/samples/conf/interop/services.xml Sun Oct 30 
21:34:11 2005
@@ -0,0 +1,24 @@
+<service name="InteropService">

+    <parameter name="ServiceClass" 
locked="xsd:false">org.apache.sandesha2.samples.interop.service.RMInteropService</parameter>

+

+   <description>

+        This is a testing service , to test the system is working or not

+    </description>

+

+  <!-- <module ref="sandesha" /> -->

+

+    <operation name="ping">  

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

+    </operation>

+

+    <operation name="echoString">

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

+    </operation>

+

+<!--

+    <operation name="ping">

+               <messageReceiver 
class="org.apache.sandesha2.msgreceivers.RMMessageReceiver" />

+       </operation> 

+-->

+    

+</service>
\ No newline at end of file

Added: 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncEchoClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncEchoClient.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncEchoClient.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncEchoClient.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,126 @@
+/*

+ * 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.samples.interop.clients;

+

+import javax.xml.namespace.QName;

+

+import org.apache.axis2.AxisFault;

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

+import org.apache.axis2.clientapi.AsyncResult;

+import org.apache.axis2.clientapi.Call;

+import org.apache.axis2.clientapi.Callback;

+import org.apache.axis2.clientapi.MessageSender;

+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.sandesha2.Constants;

+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/InteropService";

+

+       private String acksToEPR = "http://"; + ackIP +  ":" + ackPort + 
"/axis2/services/AnonymousService/echoString";

+       

+       private String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur 
path.

+       

+       private String AXIS2_CLIENT_PATH = SANDESHA2_HOME + 
"\\target\\client\\";   //this will be available after a maven build

+       

+       public static void main(String[] args) throws AxisFault {               

+               new AsyncEchoClient ().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("sandesha"));

+               call.set(Constants.AcksTo,acksToEPR); //Optional

+               call.setTo(new EndpointReference(toEPR));

+               call.set(Constants.SEQUENCE_KEY,"sequence1");  //Optional

+               call.set(Constants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); 
 //Optional

+               
call.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);

+               Callback callback1 = new TestCallback ("Callback 1");

+               call.invokeNonBlocking("echoString", 
getEchoOMBlock("echo1"),callback1);

+               Callback callback2 = new TestCallback ("Callback 2");

+               call.invokeNonBlocking("echoString", 
getEchoOMBlock("echo2"),callback2);

+               call.set(Constants.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("",null);

+               OMElement echoElement = fac.createOMElement("echoString", 
defaultNS);

+               OMElement paramElement = fac.createOMElement("text", defaultNS);

+               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");

+               }

+       }

+

+       

+}


Added: 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncPingClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncPingClient.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncPingClient.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/AsyncPingClient.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,82 @@
+/*

+ * 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.samples.interop.clients;

+

+import javax.xml.namespace.QName;

+

+import org.apache.axis2.AxisFault;

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

+import org.apache.axis2.clientapi.MessageSender;

+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.sandesha2.Constants;

+

+

+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/InteropService";

+

+       private String acksToEPR = "http://"; + ackIP +  ":" + ackPort + 
"/axis2/services/AnonymousService/echoString";

+       

+       private String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur 
path.

+       

+       private String AXIS2_CLIENT_PATH = SANDESHA2_HOME + 
"\\target\\client\\";   //this will be available after a maven build

+       

+       public static void main(String[] args) throws AxisFault {

+               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);

+               sender.set(Constants.AcksTo,acksToEPR);

+               sender.engageModule(new QName ("sandesha"));

+               sender.setTo(new EndpointReference(toEPR));

+               sender.set(Constants.SEQUENCE_KEY,"sequence1");

+               sender.send("ping",getPingOMBlock("ping1"));

+               sender.send("ping",getPingOMBlock("ping2"));

+               sender.set(Constants.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/org/apache/sandesha2/samples/interop/clients/SyncEchoClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncEchoClient.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncEchoClient.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncEchoClient.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,118 @@
+/*

+ * 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.samples.interop.clients;

+

+import javax.xml.namespace.QName;

+

+import org.apache.axis2.AxisFault;

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

+import org.apache.axis2.clientapi.AsyncResult;

+import org.apache.axis2.clientapi.Call;

+import org.apache.axis2.clientapi.Callback;

+import org.apache.axis2.clientapi.MessageSender;

+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.sandesha2.Constants;

+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/InteropService";

+

+       private String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur 
path.

+       

+       private String AXIS2_CLIENT_PATH = SANDESHA2_HOME + 
"\\target\\client\\";   //this will be available after a maven build

+       

+       public static void main(String[] args) throws AxisFault {

+               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("sandesha"));

+               call.setTo(new EndpointReference(toEPR));

+               call.set(Constants.SEQUENCE_KEY,"sequence1");  //Optional

+               call.set(Constants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); 
 //Optional

+               
call.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);

+               Callback callback1 = new TestCallback ("Callback 1");

+               call.invokeNonBlocking("echoString", 
getEchoOMBlock("echo1"),callback1);

+               Callback callback2 = new TestCallback ("Callback 2");

+               call.invokeNonBlocking("echoString", 
getEchoOMBlock("echo2"),callback2);

+               call.set(Constants.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("",null);

+               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 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/org/apache/sandesha2/samples/interop/clients/SyncPingClient.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncPingClient.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncPingClient.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/clients/SyncPingClient.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,74 @@
+/*

+ * 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.samples.interop.clients;

+

+import javax.xml.namespace.QName;

+

+import org.apache.axis2.AxisFault;

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

+import org.apache.axis2.clientapi.MessageSender;

+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.sandesha2.Constants;

+

+public class SyncPingClient {

+

+       private String toIP = "127.0.0.1";

+       

+       private String toPort = "8070";

+       

+       private String toEPR = "http://"; + toIP +  ":" + toPort + 
"/axis2/services/InteropService";

+

+       private String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur 
path.

+       

+       private String AXIS2_CLIENT_PATH = SANDESHA2_HOME + 
"\\target\\client\\";   //this will be available after a maven build

+       

+       public static void main(String[] args) throws AxisFault {

+               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 ("sandesha"));

+               sender.setTo(new EndpointReference(toEPR));

+               sender.set(Constants.SEQUENCE_KEY,"sequence1");

+               sender.send("ping",getPingOMBlock("ping1"));

+               sender.send("ping",getPingOMBlock("ping2"));

+               sender.set(Constants.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/org/apache/sandesha2/samples/interop/service/RMInteropService.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/service/RMInteropService.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/service/RMInteropService.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/samples/interop/service/RMInteropService.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,91 @@
+/*

+ * 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 org.apache.sandesha2.samples.interop.service;

+

+

+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);

+    }

+}


Added: 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/SimpleSandesha2Server.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/SimpleSandesha2Server.java?rev=329754&view=auto
==============================================================================
--- 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/SimpleSandesha2Server.java
 (added)
+++ 
webservices/sandesha/trunk/samples/src/org/apache/sandesha2/simpleServer/SimpleSandesha2Server.java
 Sun Oct 30 21:34:11 2005
@@ -0,0 +1,38 @@
+/*

+ * 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.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\\server\\";   //this will be available after a maven build

+       

+       public static void main(String[] args) throws AxisFault {

+               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]

Reply via email to