chamikara    2005/05/13 19:45:39

  Modified:    sandesha/interop/org/apache/sandesha/samples/interop/testclient
                        InteropBean.java InteropCallback.java
                        InteropStub.java TestRunnerThread.java
  Log:
  Changed the interop stub class
  
  Revision  Changes    Path
  1.2       +8 -20     
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropBean.java
  
  Index: InteropBean.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InteropBean.java  10 May 2005 16:16:57 -0000      1.1
  +++ InteropBean.java  14 May 2005 02:45:39 -0000      1.2
  @@ -12,48 +12,36 @@
        private int noOfMsgs;
        private String terminate;
        private String acks;
  +     private String acksTo;
        
  -     
  -     
  +    public String getAcksTo() {
  +        return acksTo;
  +    }
  +
  +    public void setAcksTo(String acksTo) {
  +        this.acksTo = acksTo;
  +    }
   
  -     /**
  -      * @return
  -      */
        public String getAcks() {
                return acks;
        }
   
  -     /**
  -      * @return
  -      */
        public String getFrom() {
                return from;
        }
   
  -     /**
  -      * @return
  -      */
        public int getNoOfMsgs() {
                return noOfMsgs;
        }
   
  -     /**
  -      * @return
  -      */
        public String getOperation() {
                return operation;
        }
   
  -     /**
  -      * @return
  -      */
        public String getReplyto() {
                return replyto;
        }
   
  -     /**
  -      * @return
  -      */
        public String getTarget() {
                return target;
        }
  
  
  
  1.2       +14 -2     
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropCallback.java
  
  Index: InteropCallback.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropCallback.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InteropCallback.java      10 May 2005 16:16:57 -0000      1.1
  +++ InteropCallback.java      14 May 2005 02:45:39 -0000      1.2
  @@ -53,9 +53,15 @@
                        msgType = "acknowledgement";
                }else{
                        msgType = "service response";
  +                     
                }
                
  -                     String entry = "<br /><font color='red'> Got " + 
msgType +" message. ID : " + result.getMessageId() + "</font>";  // + 
result.getSequenceId() + " </font>";
  +             String entry = "";
  +             if(result.getMessageId()!=null && result.getMessageId()!="")
  +                         entry = "<br /><font color='red' size='2' > Got " + 
msgType +" message. ID : " + result.getMessageId() + "</font>";  // + 
result.getSequenceId() + " </font>";
  +                     else
  +                         entry = "<br /><font color='red' size='2' > Got " + 
msgType + "</font>";
  +
                        
                        boolean b = writer.write(entry);
                        if(!b)
  @@ -80,7 +86,13 @@
        else if(type==Constants.MSG_TYPE_SERVICE_RESPONSE)
            msgType = "service response";  
        
  -     String entry = "<br /><font color='blue'> Sent " + msgType +" message. 
ID : " + result.getMessageId() + "</font>";// + result.getSequenceId() + " 
</font>";
  +     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)
  
  
  
  1.3       +180 -18   
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropStub.java
  
  Index: InteropStub.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/InteropStub.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InteropStub.java  11 May 2005 13:04:26 -0000      1.2
  +++ InteropStub.java  14 May 2005 02:45:39 -0000      1.3
  @@ -14,6 +14,7 @@
   import org.apache.axis.client.Call;
   import org.apache.axis.client.Service;
   import org.apache.axis.encoding.XMLType;
  +import org.apache.axis.message.addressing.util.AddressingUtils;
   import org.apache.axis.utils.XMLUtils;
   import org.apache.sandesha.Constants;
   import org.apache.sandesha.RMInitiator;
  @@ -29,7 +30,179 @@
    */
   public class InteropStub {
        
  -     public void runPingSync(InteropBean bean){
  +     
  +    public void runPing(InteropBean bean){
  +             
  +        
  +        String target = bean.getTarget();
  +             String from = bean.getFrom();
  +             String replyTo = bean.getReplyto();
  +             String acksTo = bean.getAcksTo();
  +             String acks = bean.getAcks();
  +             String terminate = bean.getTerminate();
  +             String operation = bean.getOperation();
  +             int messages = bean.getNoOfMsgs();
  +                     
  +             System.out.println(target);
  +             System.out.println(from);
  +             System.out.println(replyTo);
  +             System.out.println(acksTo);
  +             System.out.println(acks);
  +             System.out.println(terminate);
  +             System.out.println(operation);
  +             System.out.println(messages);
  +             
  +             
  +             if(replyTo!=null && replyTo.equalsIgnoreCase("anonymous"))
  +                 replyTo = AddressingUtils.getAnonymousRoleURI();
  +             
  +             if(from!=null && from.equalsIgnoreCase("anonymous"))
  +                 from = AddressingUtils.getAnonymousRoleURI();
  +             
  +             if(acksTo!=null && acksTo.equalsIgnoreCase("anonymous"))
  +                 acksTo = AddressingUtils.getAnonymousRoleURI();
  +             
  +             
  +             try {
  +                 boolean sync = false;
  +                     
  +                 if(acksTo.equals(AddressingUtils.getAnonymousRoleURI())){
  +                         sync = true;
  +                     }
  +
  +                     System.out.println("********Running ping 2**********");
  +                     
  +                     RMInitiator.initClient(sync);
  +
  +                     Service service = new Service();
  +                     Call call = (Call) service.createCall();
  +
  +                     System.out.println("Ping sync:" + sync);
  +                     call.setProperty(Constants.ClientProperties.SYNC, new 
Boolean(sync));
  +                     
  +                     call.setProperty(Constants.ClientProperties.ACTION, 
"sandesha:ping");
  +            
  +                     
  +                     //these three properties are optional
  +                     
call.setProperty(Constants.ClientProperties.ACKS_TO,acksTo);
  +                     
  +                     if(from!=null && from!="")
  +                         
call.setProperty(Constants.ClientProperties.FROM,from);
  +                     
  +                     if(replyTo!=null && replyTo!="")
  +                         
call.setProperty(Constants.ClientProperties.REPLY_TO,replyTo);
  +                     
  +                     call.setTargetEndpointAddress(target);
  +                     call.setOperationName(new QName("RMInteropService", 
operation));
  +                     call.setTransport(new RMTransport(target, ""));
  +
  +                     call.addParameter("arg1", XMLType.XSD_STRING, 
ParameterMode.IN);
  +            
  +                     for(int i=1;i<=messages;i++){
  +                             
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long((i)));
  +                             if(i==messages){
  +                                     
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true));
  +                             }
  +                             String msg = "Ping Message Number " + i;
  +                             call.invoke(new Object[]{msg});
  +     
  +                     }
  +
  +                     RMInitiator.stopClient();       
  +
  +                     } catch (Exception e) {
  +                             e.printStackTrace();
  +                     }       
  +    }
  +    
  +    public void runEcho(InteropBean bean){   
  +        
  +        String target = bean.getTarget();
  +             String from = bean.getFrom();
  +             String replyTo = bean.getReplyto();
  +             String acksTo = bean.getAcksTo();
  +             String acks = bean.getAcks();
  +             String terminate = bean.getTerminate();
  +             String operation = bean.getOperation();
  +             int messages = bean.getNoOfMsgs();
  +                     
  +             System.out.println(target);
  +             System.out.println(from);
  +             System.out.println(replyTo);
  +             System.out.println(acksTo);
  +             System.out.println(acks);
  +             System.out.println(terminate);
  +             System.out.println(operation);
  +             System.out.println(messages);
  +             
  +             
  +             if(replyTo!=null && replyTo.equalsIgnoreCase("anonymous"))
  +                 replyTo = AddressingUtils.getAnonymousRoleURI();
  +             
  +             if(from!=null && from.equalsIgnoreCase("anonymous"))
  +                 from = AddressingUtils.getAnonymousRoleURI();
  +             
  +             if(acksTo!=null && acksTo.equalsIgnoreCase("anonymous"))
  +                 acksTo = AddressingUtils.getAnonymousRoleURI();
  +             
  +             
  +             try {
  +                 boolean sync = false;
  +                 
  +                     System.out.println("********Running echo 2**********");
  +                     
  +                     RMInitiator.initClient(sync);
  +
  +                     Service service = new Service();
  +                     Call call = (Call) service.createCall();
  +
  +                     System.out.println("Echo sync:" + sync);
  +                     call.setProperty(Constants.ClientProperties.SYNC, new 
Boolean(sync));
  +                     
  +                     call.setProperty(Constants.ClientProperties.ACTION, 
"urn:wsrm:echoString");
  +            
  +                     
  +                     //these three properties are optional. If not set they 
will be set depending on sync.
  +                     
call.setProperty(Constants.ClientProperties.ACKS_TO,acksTo);
  +                     
  +                     if(from!=null && from!="")
  +                         
call.setProperty(Constants.ClientProperties.FROM,from);
  +                     
  +                     if(replyTo!=null && replyTo!="")
  +                         
call.setProperty(Constants.ClientProperties.REPLY_TO,replyTo);
  +                     
  +                     System.out.println("reply to is :" + replyTo);
  +                     call.setTargetEndpointAddress(target);
  +                     call.setOperationName(new QName("RMInteropService", 
operation));
  +                     call.setTransport(new RMTransport(target, ""));
  +             
  +            call.addParameter("arg1", XMLType.XSD_STRING, ParameterMode.IN);
  +            call.addParameter("arg2", XMLType.XSD_STRING, ParameterMode.IN);
  +            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
  +
  +                     for(int i=1;i<=messages;i++){
  +                             
call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long((i)));
  +                             String msg = "ECHO " + i;
  +                             
  +
  +                             if(i==messages){
  +                                     
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true));
  +                             }
  +                             
  +                             String ret = (String) call.invoke(new 
Object[]{msg,"abcdef"});
  +                             System.out.println("Got response from server " 
+ ret);
  +                     }
  +
  +            RMInitiator.stopClient();
  +                     
  +                     
  +             } catch (Exception e) {
  +                     e.printStackTrace();
  +             }           
  +                 
  +    }
  +    
  +   /* public void runPingSync(InteropBean bean){
                String target = bean.getTarget();
                String from = bean.getFrom();
                String replyTo = bean.getReplyto();
  @@ -50,14 +223,15 @@
   
                        call.setProperty(Constants.ClientProperties.SYNC, new 
Boolean(true));
                        call.setProperty(Constants.ClientProperties.ACTION, 
"sandesha:ping");
  -
  +            call.setProperty(Constants.ClientProperties.ACKS_TO,
  +                    Constants.WSA.NS_ADDRESSING_ANONYMOUS);
                        //These two are additional
                        
//call.setProperty("from","http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous";);
                        
//call.setProperty("replyTo","http://10.10.0.4:8080/axis/services/MyService";);
                        
//http://schemas.xmlsoap.org/ws/2003/03/addressing/role/anonymous
   
  -                     
call.setProperty(Constants.ClientProperties.FROM,Constants.WSA.NS_ADDRESSING_ANONYMOUS);
  -                     
  +                     
call.setProperty(Constants.ClientProperties.FROM,AddressingUtils.getAnonymousRoleURI());
  +                     System.out.println("ANON IS |:" + 
AddressingUtils.getAnonymousRoleURI());
                        call.setTargetEndpointAddress(target);
                        call.setOperationName(new QName("RMInteropService", 
operation));
                        call.setTransport(new RMTransport(target, ""));
  @@ -73,18 +247,6 @@
                                        
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true));
                                }
                        }
  -                     //First Message
  -                     
/*call.setProperty(Constants.ClientProperties.MSG_NUMBER, new Long(1));
  -                     call.invoke(new Object[]{"Ping Message Number One"});
  -
  -                     //Second Message
  -                     call.setProperty(Constants.ClientProperties.MSG_NUMBER, 
new Long(2));
  -                     call.invoke(new Object[]{"Ping Message Number Two"});
  -
  -                     //Third Message
  -                     call.setProperty(Constants.ClientProperties.MSG_NUMBER, 
new Long(3));
  -                     
call.setProperty(Constants.ClientProperties.LAST_MESSAGE, new Boolean(true)); 
//For last message.
  -                     call.invoke(new Object[]{"Ping Message Number 
Three"});*/
   
                        RMInitiator.stopClient();
   
  @@ -172,7 +334,7 @@
                    call.setProperty(Constants.ClientProperties.ACTION, 
"sandesha:echo");
   
                    //These two are additional, We need them since we need to 
monitor the messages using TCPMonitor.
  -                 
call.setProperty(Constants.ClientProperties.FROM,Constants.WSA.NS_ADDRESSING_ANONYMOUS);
  +                 
call.setProperty(Constants.ClientProperties.FROM,AddressingUtils.getAnonymousRoleURI());
                    
call.setProperty(Constants.ClientProperties.REPLY_TO,"http://127.0.0.1:"; + 
"9070" + "/axis/services/RMService");
                                
                                
  @@ -264,6 +426,6 @@
           } catch (Exception e) {
               e.printStackTrace();
           }            
  -     }
  +     }*/
        
   }
  
  
  
  1.2       +4 -16     
ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/TestRunnerThread.java
  
  Index: TestRunnerThread.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/sandesha/interop/org/apache/sandesha/samples/interop/testclient/TestRunnerThread.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestRunnerThread.java     10 May 2005 16:16:57 -0000      1.1
  +++ TestRunnerThread.java     14 May 2005 02:45:39 -0000      1.2
  @@ -33,24 +33,12 @@
                
                
                if(operation.equalsIgnoreCase("ping")){
  -                     //JOptionPane.showMessageDialog(null,"RUNNING PING");
  -                     String from = bean.getFrom();
  -                     if(from==null || from.equalsIgnoreCase("anonymous 
URI")){
  -                             //JOptionPane.showMessageDialog(null,"RUNNING 
SYNC");
  -                             stub.runPingSync(bean);
  -                     }else {
  -                             //JOptionPane.showMessageDialog(null,"RUNNING 
ASYNC");
  -                             stub.runPingAsync(bean);
  -                     }
  +
  +                 stub.runPing(bean);
                        
                }else if(operation.equalsIgnoreCase("echoString") ){
  -                     String from = bean.getFrom();
  -                     if(from==null || from.equalsIgnoreCase("anonymous 
URI")){
  -                             stub.runEchoStringSync(bean);
  -                     }else {
  -                             stub.runEchoStringAsync(bean);
  -                     }
  -                     
  +                 
  +                 stub.runEcho(bean);
                }
                
        }
  
  
  

Reply via email to