axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: xml-axis/java/samples/userguide/example5 Client.java
Date Fri, 19 Oct 2001 15:49:20 GMT
dug         01/10/19 08:49:20

  Modified:    java     build.xml
               java/samples/userguide/example1 TestClient.java
               java/samples/userguide/example2 CalcClient.java
                        Calculator.java
               java/samples/userguide/example3 Client.java
               java/samples/userguide/example4 Client.java
               java/samples/userguide/example5 Client.java
  Log:
  Convert the userguide samples
  
  Revision  Changes    Path
  1.64      +1 -1      xml-axis/java/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/build.xml,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- build.xml	2001/10/18 18:54:54	1.63
  +++ build.xml	2001/10/19 15:49:20	1.64
  @@ -217,7 +217,7 @@
         <include name="test/**/*.java" />
         <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
         <exclude name="**/old/**/*.java" />
  -      <exclude name="samples/userguide/example2/*.java"/>
  +      <exclude name="samples/userguide/example2/Calculator.java"/>
       </javac>
     </target>
   
  
  
  
  1.5       +15 -7     xml-axis/java/samples/userguide/example1/TestClient.java
  
  Index: TestClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example1/TestClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestClient.java	2001/08/10 16:29:47	1.4
  +++ TestClient.java	2001/10/19 15:49:20	1.5
  @@ -55,19 +55,27 @@
   
   package samples.userguide.example1;
   
  -import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.encoding.XMLType;
   
   public class TestClient
   {
      public static void main(String [] args) {
          try {
  -           String endpoint = "http://nagoya.apache.org:5049/axis/servlet/AxisServlet";
  +           String endpoint = 
  +                    "http://nagoya.apache.org:5049/axis/servlet/AxisServlet";
        
  -           ServiceClient client = new ServiceClient(endpoint);
  -           String ret = (String)client.invoke("http://soapinterop.org/",
  -                                              "echoString",
  -                                              new Object [] { "Hello!" });
  -           
  +           Service  service = new Service();
  +           Call     call    = (Call) service.createCall();
  +
  +           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
  +           call.setOperationName( "echoString" );
  +           call.addParameter( "string", XMLType.XSD_STRING, Call.PARAM_MODE_IN);
  +           call.setProperty( Call.NAMESPACE, "http://soapinterop.org/" );
  +
  +           String ret = (String) call.invoke( new Object[] { "Hello!" } );
  +
              System.out.println("Sent 'Hello!', got '" + ret + "'");
          } catch (Exception e) {
              System.err.println(e.toString());
  
  
  
  1.5       +15 -6     xml-axis/java/samples/userguide/example2/CalcClient.java
  
  Index: CalcClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example2/CalcClient.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CalcClient.java	2001/08/14 20:01:39	1.4
  +++ CalcClient.java	2001/10/19 15:49:20	1.5
  @@ -53,7 +53,11 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.axis.client.ServiceClient;
  +package samples.userguide.example2 ;
  +
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.encoding.XMLType;
   import org.apache.axis.utils.Options;
   
   public class CalcClient
  @@ -66,7 +70,7 @@
          
          args = options.getRemainingArgs();
          
  -       if (args.length != 3) {
  +       if (args == null || args.length != 3) {
              System.err.println("Usage: CalcClient <add|subtract> arg1 arg2");
              return;
          }
  @@ -79,11 +83,16 @@
          
          Integer i1 = new Integer(args[1]);
          Integer i2 = new Integer(args[2]);
  +
  +       Service  service = new Service();
  +       Call     call    = (Call) service.createCall();
  +
  +       call.setTargetEndpointAddress( new java.net.URL(endpoint) );
  +       call.setOperationName( method );
  +       call.addParameter( "op1", XMLType.XSD_INT, Call.PARAM_MODE_IN );
  +       call.addParameter( "op2", XMLType.XSD_INT, Call.PARAM_MODE_IN );
   
  -       ServiceClient client = new ServiceClient(endpoint);
  -       Integer ret = (Integer)client.invoke("",
  -                                          method,
  -                                          new Object [] { i1, i2 });
  +       Integer ret = (Integer) call.invoke( new Object [] { i1, i2 });
          
          System.out.println("Got result : " + ret);
      }
  
  
  
  1.5       +1 -1      xml-axis/java/samples/userguide/example2/Calculator.java
  
  Index: Calculator.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example2/Calculator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Calculator.java	2001/08/14 20:01:39	1.4
  +++ Calculator.java	2001/10/19 15:49:20	1.5
  @@ -64,4 +64,4 @@
     {
       return i1 - i2;
     }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.4       +12 -5     xml-axis/java/samples/userguide/example3/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example3/Client.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Client.java	2001/10/18 13:28:37	1.3
  +++ Client.java	2001/10/19 15:49:20	1.4
  @@ -55,7 +55,9 @@
   
   package samples.userguide.example3;
   
  -import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.encoding.XMLType;
   import org.apache.axis.utils.Options;
   
   public class Client
  @@ -75,10 +77,15 @@
                   textToSend = args[0];
               }
               
  -            ServiceClient client = new ServiceClient(endpointURL);
  -            
  -            String ret = (String)client.invoke("MyService", "serviceMethod",
  -                                               new Object [] { textToSend });
  +            Service  service = new Service();
  +            Call     call    = (Call) service.createCall();
  +
  +            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
  +            call.setOperationName( "serviceMethod" );
  +            call.setProperty( Call.NAMESPACE, "MyService" );
  +            call.addParameter( "arg1", XMLType.XSD_STRING, Call.PARAM_MODE_IN);
  +
  +            String ret = (String) call.invoke( new Object[] { textToSend } );
               
               System.out.println("You typed : " + ret);
           } catch (Exception e) {
  
  
  
  1.5       +13 -4     xml-axis/java/samples/userguide/example4/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example4/Client.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Client.java	2001/10/18 13:28:37	1.4
  +++ Client.java	2001/10/19 15:49:20	1.5
  @@ -55,7 +55,9 @@
   
   package samples.userguide.example4;
   
  -import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.encoding.XMLType;
   import org.apache.axis.utils.Options;
   
   public class Client
  @@ -67,9 +69,16 @@
               
               String endpointURL = options.getURL();
               
  -            ServiceClient client = new ServiceClient(endpointURL);
  -            
  -            client.invoke("LogTestService", "testMethod", new Object [] {});
  +            Service  service = new Service();
  +            Call     call    = (Call) service.createCall();
  +
  +            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
  +            call.setOperationName( "testMethod" );
  +            call.setProperty( Call.NAMESPACE, "LogTestService" );
  +
  +            String res = (String) call.invoke( new Object[] {} );
  +
  +            System.out.println( res );
           } catch (Exception e) {
               System.err.println(e.toString());
           }
  
  
  
  1.7       +15 -7     xml-axis/java/samples/userguide/example5/Client.java
  
  Index: Client.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/userguide/example5/Client.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Client.java	2001/10/18 18:02:09	1.6
  +++ Client.java	2001/10/19 15:49:20	1.7
  @@ -56,7 +56,9 @@
   package samples.userguide.example5;
   
   import org.apache.axis.AxisFault;
  -import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.client.Call;
  +import org.apache.axis.client.Service;
  +import org.apache.axis.encoding.XMLType;
   import org.apache.axis.utils.Options;
   import javax.xml.rpc.namespace.QName;
                                              
  @@ -76,15 +78,21 @@
           order.setItemCodes(items);
           order.setQuantities(quantities);
           
  -        ServiceClient client = new ServiceClient(options.getURL());
  -        client.addSerializer(Order.class, new QName("urn:BeanService", "Order"),
  -                             new org.apache.axis.encoding.BeanSerializer(Order.class));
  +        Service  service = new Service();
  +        Call     call    = (Call) service.createCall();
  +        QName    qn      = new QName( "urn:BeanService", "Order" );
  +
  +        call.addSerializer(Order.class, qn,
  +                    new org.apache.axis.encoding.BeanSerializer(Order.class));
           
           String result;
           try {
  -            result = (String)client.invoke("OrderProcessor",
  -                                           "processOrder",
  -                                           new Object[] { order });
  +            call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
  +            call.setProperty( Call.NAMESPACE, "OrderProcessor" );
  +            call.setOperationName( "processOrder" );
  +            call.addParameter( "arg1", new XMLType(qn), Call.PARAM_MODE_IN );
  +
  +            result = (String) call.invoke( new Object[] { order } );
           } catch (AxisFault fault) {
               result = "Error : " + fault.toString();
           }
  
  
  

Mime
View raw message