You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/08/14 21:02:33 UTC

cvs commit: xml-axis/java/samples/userguide/example2 CalcClient.java Calculator.java

gdaniels    01/08/14 12:02:33

  Modified:    java/docs Tag: alpha-1 user-guide.html
               java/samples/userguide/example2 Tag: alpha-1 CalcClient.java
                        Calculator.java
  Log:
  It's nice if the examples actually work the way they're supposed to.
  
  Exclude example2/ from the samples build, and allow Calculator
  to be used as a JWS (i.e. remove the package declaration).
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.2  +7 -5      xml-axis/java/docs/user-guide.html
  
  Index: user-guide.html
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/docs/user-guide.html,v
  retrieving revision 1.10.2.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- user-guide.html	2001/08/14 00:03:06	1.10.2.1
  +++ user-guide.html	2001/08/14 19:02:33	1.10.2.2
  @@ -274,20 +274,22 @@
     rename it "Calculator.jws". So you might do something like this:</p>
   <pre>% copy Calculator.java <i><font color="#0000FF">&lt;your-webapp-root&gt;</font></i>/axis/Calculator.jws</pre>
   <p>Now for step 2... hm, wait a minute. You're done! You should now be able to 
  -  access the service at the following URL (assuming you've mapped the Axis web 
  -  application to port 80):</p>
  -<p><a href="http://localhost/axis/Calculator.jws">http://localhost/axis/Calculator.jws</a> 
  +  access the service at the following URL (assuming your Axis web application 
  +  is on port 8080):</p>
  +<p><a href="http://localhost:8080/axis/Calculator.jws">http://localhost:8080/axis/Calculator.jws</a> 
   </p>
   <p>Axis automatically locates the file, compiles the class, and converts SOAP 
     calls correctly into Java invocations of your service class. Try it out - there's 
     a calculator client in samples/userguide/example2/CalcClient.java, which you 
     can use like this:</p>
   <pre>% javac CalcClient.java
  -% java CalcClient add 2 5
  +% java CalcClient -p8080 add 2 5
   Got result : 7
  -% java CalcClient subtract 10 9
  +% java CalcClient -p8080 subtract 10 9
   Got result : 1
   % </pre>
  +(note that you may need to replace the &quot;-p8080&quot; with whatever port your 
  +J2EE server is running on) 
   <h3>Custom Deployment - deploy.xml files and the AdminClient</h3>
   <p>JWS files are great quick ways to get your classes out there as Web Services, 
     but they're not always the best choice. For one thing, you need the source code 
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +7 -3      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.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- CalcClient.java	2001/08/10 16:29:47	1.3
  +++ CalcClient.java	2001/08/14 19:02:33	1.3.2.1
  @@ -53,14 +53,18 @@
    * <http://www.apache.org/>.
    */
   
  -package samples.userguide.example2;
  -
   import org.apache.axis.client.ServiceClient;
  +import org.apache.axis.utils.Options;
   
   public class CalcClient
   {
      public static void main(String [] args) throws Exception {
  -       String endpoint = "http://localhost:8080/axis/Calculator.jws";
  +       Options options = new Options(args);
  +       
  +       String endpoint = "http://localhost:" + options.getPort() +
  +                         "/axis/Calculator.jws";
  +       
  +       args = options.getRemainingArgs();
          
          if (args.length != 3) {
              System.err.println("Usage: CalcClient <add|subtract> arg1 arg2");
  
  
  
  1.3.2.1   +0 -2      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.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- Calculator.java	2001/08/10 16:29:47	1.3
  +++ Calculator.java	2001/08/14 19:02:33	1.3.2.1
  @@ -53,8 +53,6 @@
    * <http://www.apache.org/>.
    */
   
  -package samples.userguide.example2;
  -
   public class Calculator {
     public int add(int i1, int i2)
     {