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 ja...@apache.org on 2005/06/11 10:57:31 UTC

cvs commit: ws-fx/sandesha/interop/org/apache/sandesha/interop/testclient InteropBean.java InteropCallback.java InteropStub.java ResponseWriter.java

jaliya      2005/06/11 01:57:31

  Added:       sandesha/interop/org/apache/sandesha/interop
                        IBMAsyncPing.java IBMEcho.java IBMSyncPing.java
                        MicrosoftAsyncPing.java MicrosoftSyncPing.java
                        RMInteropService.java SystinetAsyncPing.java
                        SystinetSyncPing.java
               sandesha/interop/org/apache/sandesha/interop/testclient
                        InteropBean.java InteropCallback.java
                        InteropStub.java ResponseWriter.java
  Log:
  Added the interop classes
  
  Revision  Changes    Path
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/IBMAsyncPing.java
  
  Index: IBMAsyncPing.java
  ===================================================================
  
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.encoding.XMLType;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  /**
   * Test client for Ping scenario for IBM.
   *
   * @auther Jaliya Ekanyake
   */
  public class IBMAsyncPing {
  
      private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
      private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
      private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
      //client side.
  
      public static void main(String[] args) {
          System.out.println("Client started...... Asynchronous Ping - IBM");
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY);
  
              ctx.setToUrl(call, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
              ctx.setFaultToUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setAcksToUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setFromUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
  
              call.setOperationName(new QName("http://tempuri.org/", "Ping"));
  
              call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
  
              call.invoke(new Object[]{"Ping Message Number One"});
              call.invoke(new Object[]{"Ping Message Number Two"});
              ctx.setLastMessage(call);
              call.invoke(new Object[]{"Ping Message Number Three"});
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/IBMEcho.java
  
  Index: IBMEcho.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.components.uuid.UUIDGen;
  import org.apache.axis.components.uuid.UUIDGenFactory;
  import org.apache.axis.encoding.XMLType;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.RMTransport;
  import org.apache.sandesha.SandeshaContext;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  /**
   * Test client for echoString scenario for IBM.
   *
   * @auther Jaliya Ekanyake
   */
  public class IBMEcho {
      private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
      private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
      private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
      //client side.
  
      public static void main(String[] args) {
  
          System.out.println("Client started...... Asynchronous EchoString - IBM");
  
            UUIDGen uuidGen = UUIDGenFactory.getUUIDGen(); //Can use this for continuous testing.
              String str = uuidGen.nextUUID();
  
          try {
                Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:echoString",Constants.ClientProperties.IN_OUT);
  
              ctx.setToUrl(call, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
              ctx.setFaultToUrl(call,"http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setAcksToUrl(call,"http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setFromUrl(call,"http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setReplyToUrl(call,"http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
  
              call.setOperationName(new QName("http://tempuri.org/", "echoString"));
  
              call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
              call.addParameter("Sequence", XMLType.XSD_STRING, ParameterMode.IN);
              call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
  
              String ret = (String) call.invoke(new Object[]{"Sandesha Echo 1", str});
              System.out.println("The Response for First Messsage is  :" + ret);
  
              ret = (String) call.invoke(new Object[]{"Sandesha Echo 2", str});
              System.out.println("The Response for Second Messsage is  :" + ret);
  
              ctx.setLastMessage(call);
              ret = (String) call.invoke(new Object[]{"Sandesha Echo 3", str});
              System.out.println("The Response for Third Messsage is  :" + ret);
  
               ctx.endSequence(call);
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/IBMSyncPing.java
  
  Index: IBMSyncPing.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.encoding.XMLType;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  /**
   * Test client for Ping scenario for IBM.
   *
   * @auther Jaliya Ekanyake
   */
  
  public class IBMSyncPing {
  
      private static String targetURL = "http://127.0.0.1:8080/wsrm/services/rmDemos";
  
      public static void main(String[] args) {
          System.out.println("Client started...... Synchronous Ping - IBM");
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY);
              ctx.setSynchronous(call);
              ctx.setToUrl(call, "http://wsi.alphaworks.ibm.com:8080/wsrm/services/rmDemos");
              ctx.setAcksToUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
  
              call.setOperationName(new QName("http://tempuri.org/", "Ping"));
  
              call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
  
              call.invoke(new Object[]{"Ping Message Number One"});
              call.invoke(new Object[]{"Ping Message Number Two"});
              ctx.setLastMessage(call);
              call.invoke(new Object[]{"Ping Message Number Three"});
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              //System.err.println(e.toString());
              e.printStackTrace();
          }
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/MicrosoftAsyncPing.java
  
  Index: MicrosoftAsyncPing.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.Message;
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  /**
   * Test client for Ping scenario for Microsoft.
   *
   * @auther Jaliya Ekanyake
   */
  public class MicrosoftAsyncPing {
  
      private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
      private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
      private static String targetURL = "http://127.0.0.1:8080/SecureReliableMessaging/ReliableOneWayDual.svc";
  
      public static void main(String[] args) {
          System.out.println("Client started...... Asynchronous - Microsoft");
          try {
  
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY);
  
              ctx.setToUrl(call,
                      "http://131.107.153.195/SecureReliableMessaging/ReliableOneWayDual.svc");
              ctx.setFromUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setAcksToUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setFaultToUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setReplyToUrl(call,
                      "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
  
              call.setOperationName("Ping");
              call.invoke(new Message(getSOAPEnvelope(1)));
              call.invoke(new Message(getSOAPEnvelope(2)));
              ctx.setLastMessage(call);
              call.invoke(new Message(getSOAPEnvelope(3)));
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
      private static String getSOAPEnvelope(int i) {
          return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\n" +
                  "   <soapenv:Header>\n" + "   </soapenv:Header>\n" + "   <soapenv:Body>\n" + "      <Ping xmlns=\"http://tempuri.org/\">\n" +
                  "         <Text>Ping Message Number " + i + "</Text>\n" + "      </Ping>\n" + "   </soapenv:Body></soapenv:Envelope>";
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/MicrosoftSyncPing.java
  
  Index: MicrosoftSyncPing.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.Message;
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  /**
   * Test client for Ping scenario for Microsoft.
   *
   * @auther Jaliya Ekanyake
   */
  public class MicrosoftSyncPing {
  
      private static String targetURL = "http://127.0.0.1:8080/SecureReliableMessaging/ReliableOneWay.svc";
  
      public static void main(String[] args) {
          System.out.println("Client started...... Synchronous - Microsoft ");
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY);
              ctx.setSynchronous(call);
              ctx.setToUrl(call, "http://131.107.153.195/SecureReliableMessaging/ReliableOneWay.svc");
               //We really do not want to send wsa:ReplyTo header for a synchronous operation.
              //But Microsoft endpoint expects it for all the messages. So let's set that manually.
              ctx.setReplyToUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
  
              call.setOperationName("Ping");
  
              call.invoke(new Message(getSOAPEnvelope(1)));
              call.invoke(new Message(getSOAPEnvelope(2)));
              ctx.setLastMessage(call);
              call.invoke(new Message(getSOAPEnvelope(3)));
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
      private static String getSOAPEnvelope(int i) {
          return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">\n" +
                  "   <soapenv:Header>\n" + "   </soapenv:Header>\n" + "   <soapenv:Body>\n" + "      <Ping xmlns=\"http://tempuri.org/\">\n" +
                  "         <Text>Ping Message Number " + i + "</Text>\n" + "      </Ping>\n" + "   </soapenv:Body></soapenv:Envelope>";
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/RMInteropService.java
  
  Index: RMInteropService.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import java.util.HashMap;
  import java.util.Map;
  
  /**
   * This is the service that is used for the interop testing. Two operations, ping and echoString
   * are defined as per the interop scenarios.
   *
   * @auther Jaliya Ekanayake
   */
  public class RMInteropService {
      private static Map sequences = new HashMap();
  
      public String echoString(String text, String sequence) {
  
          if (sequences.get(sequence) != null) {
              text = (String) sequences.get(sequence) + text;
              sequences.put(sequence, new String(text));
          } else {
              sequences.put(sequence, (new String(text)));
  
          }
          System.out.println("ECHO-STRING SERVICE " + text);
          return text;
      }
  
      public void ping(String text) {
          System.out.println("PING-STRING SERVICE " + text);
      }
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/SystinetAsyncPing.java
  
  Index: SystinetAsyncPing.java
  ===================================================================
  package org.apache.sandesha.interop;
  
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.encoding.XMLType;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  /**
   * Test client for Ping scenario for Systinet.
   *
   * @auther Jaliya Ekanyake
   */
  public class SystinetAsyncPing {
  
      private static String targetURL = "http://127.0.0.1:6064/Service";
      private static String sourceHost = "192.248.18.51"; //Change this to your public IP address
      private static String sourcePort = "9070"; //Change this according to the listening port of the TCPMonitor in the
      //client side.
  
      public static void main(String[] args) {
          System.out.println("Client started...... Synchronous ");
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY);
  
              ctx.setToUrl(call, "http://soap.systinet.net:6064/Service");
              ctx.setAcksToUrl(call, "http://" + sourceHost + ":" + sourcePort +
                      "/axis/services/RMService");
              ctx.setFromUrl(call, "http://" + sourceHost + ":" + sourcePort + "/axis/services/RMService");
              ctx.setFaultToUrl(call, "http://" + sourceHost + ":" + sourcePort +
                      "/axis/services/RMService");
  
              call.setOperationName(new QName("http://tempuri.org/", "Ping"));
  
              call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
  
              call.invoke(new Object[]{"Ping Message Number One"});
  
              call.invoke(new Object[]{"Ping Message Number Two"});
              ctx.setLastMessage(call);
              call.invoke(new Object[]{"Ping Message Number Three"});
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/SystinetSyncPing.java
  
  Index: SystinetSyncPing.java
  ===================================================================
  /*
  * 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.sandesha.interop;
  
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.encoding.XMLType;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  
  /**
   * Test client for Ping scenario for Systinet with synchronous invocation. No client side listener will start
   * and all the communications will happen synchronously.
   *
   * @auther Jaliya Ekanyake
   */
  public class SystinetSyncPing {
  
      private static String targetURL = "http://127.0.0.1:6064/Service";
  
      public static void main(String[] args) {
          System.out.println("Client started...... Synchronous ");
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext();
              ctx.addNewSequeceContext(call, targetURL, "urn:wsrm:Ping",
                      Constants.ClientProperties.IN_ONLY,true);
              ctx.setToUrl(call, "http://soap.systinet.net:6064/Service");
  
              call.setTargetEndpointAddress(targetURL);
              call.setOperationName(new QName("http://tempuri.org/", "Ping"));
  
  
              call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
  
              call.invoke(new Object[]{"Ping Message Number One"});
              call.invoke(new Object[]{"Ping Message Number Two"});
              ctx.setLastMessage(call);
              call.invoke(new Object[]{"Ping Message Number Three"});
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/testclient/InteropBean.java
  
  Index: InteropBean.java
  ===================================================================
  /*
  * 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.sandesha.interop.testclient;
  
  import java.io.Serializable;
  
  /**
   * This is used to pass parameters from interop.jsp to the Sandesha
   *
   * @auther Chamikara Jayalath
   */
  public class InteropBean implements Serializable {
  
      private String target;
      private String operation;
      private String from;
      private String replyto;
      private int noOfMsgs;
  
      private String acksTo;
      private String offer;
      private String faultto;
      private String sourceURL;
  
      public String getFaultto() {
          return faultto;
      }
  
      public void setFaultto(String faultto) {
          this.faultto = faultto;
      }
  
  
      public String getSourceURL() {
          return sourceURL;
      }
  
      public void setSourceURL(String sourceURL) {
          this.sourceURL = sourceURL;
      }
  
  
      public String getAcksTo() {
          return acksTo;
      }
  
      public void setAcksTo(String acksTo) {
          this.acksTo = acksTo;
      }
  
  
      public String getFrom() {
          return from;
      }
  
      public int getNoOfMsgs() {
          return noOfMsgs;
      }
  
      public String getOperation() {
          return operation;
      }
  
      public String getReplyto() {
          return replyto;
      }
  
  
      public String getTarget() {
          return target;
      }
  
  
      /**
       * @param string
       */
      public void setFrom(String string) {
          from = string;
      }
  
      /**
       * @param i
       */
      public void setNoOfMsgs(int i) {
          noOfMsgs = i;
      }
  
      /**
       * @param string
       */
      public void setOperation(String string) {
          operation = string;
      }
  
      /**
       * @param string
       */
      public void setReplyto(String string) {
          replyto = string;
      }
  
      /**
       * @param string
       */
      public void setTarget(String string) {
          target = string;
      }
  
      public String getOffer() {
          return offer;
      }
  
      public void setOffer(String offer) {
          this.offer = offer;
      }
  
  
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/testclient/InteropCallback.java
  
  Index: InteropCallback.java
  ===================================================================
  /*
  * 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.sandesha.interop.testclient;
  
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.storage.Callback;
  import org.apache.sandesha.storage.CallbackData;
  
  /**
   *  This Callback is used to write the results of various points in the Sandesha engine.
   * @auther Chamikara Jayalath
   */
  public class InteropCallback extends Callback {
  
      private ResponseWriter writer = null;
      private boolean testFinished = false;
  
      public synchronized void setTestFinished(boolean finished) {
          this.testFinished = finished;
      }
  
      public synchronized boolean isTestFinished() {
          return testFinished;
      }
  
      public InteropCallback(ResponseWriter writer) {
          this.writer = writer;
      }
  
      public synchronized void onIncomingMessage(CallbackData result) {
  
          String action = result.getAction();
          String msgType = action;
          if (action != null) {
              if (action.equals(Constants.WSRM.ACTION_CREATE_SEQUENCE))
                  msgType = "Create Sequence";
              else if (action.equals(Constants.WSRM.ACTION_CREATE_SEQUENCE_RESPONSE))
                  msgType = "Create Sequence Response";
              else if (action.equals(Constants.WSRM.ACTION_TERMINATE_SEQUENCE))
                  msgType = "Terminate Sequence";
              else if (action.equals(Constants.WSRM.SEQUENCE_ACKNOWLEDGEMENT_ACTION))
                  msgType = "Sequence Acknowledgement";
          } else {
              msgType = "";
  
          }
  
          String entry = "";
          if (result.getMessageId() != null && result.getMessageId() != "")
              entry = "<br /><font color='green' size='2' > Received " + msgType + " Message. ID : " +
                      result.getMessageId() + "</font>";  // + result.getSequenceId() + " </font>";
          else
              entry = "<br /><font color='green' size='2' > Received " + msgType + "</font>";
  
  
          boolean b = writer.write(entry);
          if (!b)
              setTestFinished(true);
      }
  
      public synchronized void onOutgoingMessage(CallbackData result) {
  
          int type = result.getMessageType();
          String msgType = null;
  
          if (type == Constants.MSG_TYPE_CREATE_SEQUENCE_REQUEST)
              msgType = "Create Sequence";
          else if (type == Constants.MSG_TYPE_CREATE_SEQUENCE_RESPONSE)
              msgType = "Create Sequence Response";
          else if (type == Constants.MSG_TYPE_TERMINATE_SEQUENCE)
              msgType = "Terminate Sequence";
          else if (type == Constants.MSG_TYPE_ACKNOWLEDGEMENT)
              msgType = "Sequence Acknowledgement";
          else if (type == Constants.MSG_TYPE_SERVICE_REQUEST)
              msgType = "Service Request";
          else if (type == Constants.MSG_TYPE_SERVICE_RESPONSE)
              msgType = "Service Response";
  
          String entry = "";
          if (result.getMessageId() != null && result.getMessageId() != "")
              entry = "<br /><font color='blue' size='2' > Sent " + msgType + " Message. ID : " +
                      result.getMessageId() + "</font>";// + result.getSequenceId() + " </font>";
          else {
              entry = "<br /><font color='blue' size='2' > Sent " + msgType + "</font>";
          }
  
          boolean b = writer.write(entry);
          if (!b)
              setTestFinished(true);
  
          if (result.getMessageType() == 6)
              setTestFinished(true);
  
      }
  
      public synchronized void onError(Exception exp) {
          String message = "Error Occured During the Interop Test";
          if (exp.getMessage() != null) {
              message = exp.getMessage();
          }
          String entry = "<br /><font color='red' size='2' > Error : " + message + "</font>";
          boolean b = writer.write(entry);
          if (!b)
              setTestFinished(true);
          }
  
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/testclient/InteropStub.java
  
  Index: InteropStub.java
  ===================================================================
  /*
  * 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.sandesha.interop.testclient;
  
  
  import org.apache.axis.AxisFault;
  import org.apache.axis.Handler;
  import org.apache.axis.SimpleChain;
  import org.apache.axis.client.Call;
  import org.apache.axis.client.Service;
  import org.apache.axis.components.logger.LogFactory;
  import org.apache.axis.encoding.XMLType;
  import org.apache.commons.logging.Log;
  import org.apache.sandesha.Constants;
  import org.apache.sandesha.SandeshaContext;
  import org.apache.sandesha.client.ClientStorageManager;
  import org.apache.sandesha.server.Sender;
  import org.apache.sandesha.util.PolicyLoader;
  import org.apache.sandesha.util.PropertyLoader;
  
  import javax.xml.namespace.QName;
  import javax.xml.rpc.ParameterMode;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * This is class has the client for the interop testing. interop.jsp
   * simply calls the runPing and runEcho methods.
   *
   * @auther Chamikara Jayalath
   */
  
  
  public class InteropStub {
  
      private InteropStub() {
      }
  
      private static Sender sender = null;
      private static Thread thSender = null;
      private static ClientStorageManager storageManager = new ClientStorageManager();
      private static final Log log = LogFactory.getLog(InteropStub.class.getName());
  
      private static InteropStub stub = null;
  
      public static InteropStub getInstance() {
  
          if (stub != null) {
              return stub;
          } else {
              stub = new InteropStub();
              return stub;
          }
      }
  
      public static InteropCallback getCallback() {
          return callback;
      }
  
      public static void setCallback(InteropCallback callback) {
          InteropStub.callback = callback;
      }
  
      private static InteropCallback callback = null;
  
      private void configureContext(SandeshaContext ctx, Call call, InteropBean bean) {
          String from = bean.getFrom();
          String replyTo = bean.getReplyto();
          String acksTo = bean.getAcksTo();
          String faultTo = bean.getFaultto();
  
          boolean sendOffer = false;
          if (bean.getOffer().equalsIgnoreCase("yes"))
              sendOffer = true;
  
          if (replyTo != null && replyTo.equalsIgnoreCase("anonymous")) {
              ctx.setReplyToUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
          } else if (replyTo != null) {
              ctx.setReplyToUrl(call, bean.getReplyto());
          }
  
          if (from != null && from.equalsIgnoreCase("anonymous")) {
              ctx.setFromUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
          } else if (from != null) {
              ctx.setFromUrl(call, from);
          }
  
          if (acksTo != null && acksTo.equalsIgnoreCase("anonymous")) {
              ctx.setAcksToUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
          } else if (acksTo != null) {
              ctx.setAcksToUrl(call, acksTo);
          }
  
          if (faultTo != null && faultTo.equalsIgnoreCase("anonymous")) {
              ctx.setFaultToUrl(call, Constants.WSA.NS_ADDRESSING_ANONYMOUS);
          } else if (faultTo != null) {
              ctx.setFaultToUrl(call, bean.getFaultto());
          }
  
  
          if (sendOffer)
              ctx.setSendOffer(call);
  
      }
  
      public synchronized void runPing(InteropBean bean) {
  
          log.info("=========== RUNNING THE \"Ping\" INTEROP TEST ==========");
          String target = bean.getTarget();
          int msgs = bean.getNoOfMsgs();
          try {
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext(true);
              ctx.setSourceUrl(call, bean.getSourceURL());
              ctx.addNewSequeceContext(call, target, "urn:wsrm:ping",
                      Constants.ClientProperties.IN_ONLY);
  
              configureContext(ctx, call, bean);
  
  
              call.setOperationName(new QName("http://tempuri.org", "Ping"));
  
              call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
  
              for (int i = 1; i <= msgs; i++) {
                  if (i == msgs) {
                      ctx.setLastMessage(call);
                  }
                  String msg = "Sandesha Ping Message Number " + i;
                  call.invoke(new Object[]{msg});
              }
  
              //InteropStub.stopClient();
              ctx.endSequence(call);
  
          } catch (Exception e) {
              if (callback != null)
                  callback.onError(e);
             log.info(e);
          }
      }
  
      public synchronized void runEcho(InteropBean bean) {
  
          String target = bean.getTarget();
          int messages = bean.getNoOfMsgs();
          String seq = new Long(System.currentTimeMillis()).toString();
  
          try {
              log.info("=========== RUNNING THE \"echoString\" INTEROP TEST ==========");
  
              //We start the listener to be in the safe side.
              //User may specify some external(not in sandesha endpoint) replyTo address, then
              //he/she will not be able to retrieve the responses to this client, yet they can verify
              //the reliablility of the sent messages.
  
  
              Service service = new Service();
              Call call = (Call) service.createCall();
  
              SandeshaContext ctx = new SandeshaContext(true);
              ctx.setSourceUrl(call, bean.getSourceURL());
              ctx.addNewSequeceContext(call, target, "urn:wsrm:echoString",
                      Constants.ClientProperties.IN_OUT);
  
              configureContext(ctx, call, bean);
  
              call.setOperationName(new QName("http://tempuri.org/", "echoString"));
  
              call.addParameter("Text", XMLType.XSD_STRING, ParameterMode.IN);
              call.addParameter("Sequence", XMLType.XSD_STRING, ParameterMode.IN);
              call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
  
              for (int i = 1; i <= messages; i++) {
                  String msg = "Sandesha Echo String " + i;
  
                  if (i == messages) {
                      ctx.setLastMessage(call);
                  }
  
                  String ret = (String) call.invoke(new Object[]{msg, seq});
                 log.info("Got response from server " + ret);
              }
  
              ctx.endSequence(call);
  
          } catch (Exception e) {
              if (callback != null)
                  callback.onError(e);
              log.error(e);
          }
      }
  
  
      public static void initClient() {
         log.info("STARTING SENDER FOR THE CLIENT .......");
          sender = new Sender(storageManager);
  
          SimpleChain reqChain = getRequestChain();
          SimpleChain resChain = getResponseChain();
          if (reqChain != null)
              sender.setRequestChain(reqChain);
          if (resChain != null)
              sender.setResponseChain(resChain);
  
          //thSender = new Thread(sender);
          //thSender.setDaemon(false);
          //thSender.start();
          sender.startSender();
      }
  
      public static void stopClient() throws AxisFault {
          //This should check whether we have received all the acks or reponses if any
          storageManager.isAllSequenceComplete();
          long startingTime = System.currentTimeMillis();
          long inactivityTimeOut = PolicyLoader.getInstance().getInactivityTimeout();
          while (!storageManager.isAllSequenceComplete()) {
              try {
                  log.info(Constants.InfomationMessage.WAITING_TO_STOP_CLIENT);
                  Thread.sleep(Constants.CLIENT_WAIT_PERIOD_FOR_COMPLETE);
                  if ((System.currentTimeMillis() - startingTime) >= inactivityTimeOut) {
                      stopClientByForce();
                  }
              } catch (InterruptedException e) {
                 log.error(e);
              }
          }
  
          sender.stop();
          storageManager.clearStorage();
  
  
      }
  
      public static void stopClientByForce() throws AxisFault {
  
          sender.stop();
  
          throw new AxisFault("Inactivity Timeout Reached, No Response from the Server");
      }
  
      private static SimpleChain getRequestChain() {
          ArrayList arr = PropertyLoader.getRequestHandlerNames();
          return getHandlerChain(arr);
      }
  
  
      private static SimpleChain getResponseChain() {
  
          ArrayList arr = PropertyLoader.getResponseHandlerNames();
          return getHandlerChain(arr);
      }
  
      public static SimpleChain getHandlerChain(List arr) {
          SimpleChain reqHandlers = new SimpleChain();
          Iterator it = arr.iterator();
          boolean hasReqHandlers = false;
          try {
              while (it.hasNext()) {
                  hasReqHandlers = true;
                  String strClass = (String) it.next();
                  Class c = Class.forName(strClass);
                  Handler h = (Handler) c.newInstance();
                  reqHandlers.addHandler(h);
              }
          } catch (Exception e) {
              e.printStackTrace();
              return null;
          }
          if (hasReqHandlers)
              return reqHandlers;
          else
              return null;
      }
  
  }
  
  
  
  1.1                  ws-fx/sandesha/interop/org/apache/sandesha/interop/testclient/ResponseWriter.java
  
  Index: ResponseWriter.java
  ===================================================================
  
  package org.apache.sandesha.interop.testclient;
  
  import java.io.PrintWriter;
  
  
  /**
   * @author root
   *
   * To change the template for this generated type comment go to
   * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
   */
  public class ResponseWriter {
  	
  	private PrintWriter writer;
  	
  	public ResponseWriter(PrintWriter writer){
  			this.writer = writer;
  	}
  	
  	public synchronized boolean write(String s){ 
  		try{
  			writer.println(s);
  			flush();
  			return true;
  		}catch(Exception e){
  			System.out.println("Exception: In method 'write' of 'ResponseWriter'");
  			return false;
  		}
  	}
  	
  	public synchronized void flush(){
  		writer.flush();
  	}
  }