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/src/org/apache/axis/utils Options.java
Date Fri, 05 Oct 2001 13:06:22 GMT
dug         01/10/05 06:06:22

  Modified:    java/samples/stock GetQuote.wsdl GetQuote1.java
               java/src/org/apache/axis/utils Options.java
  Log:
  Change the GetQuote.wsdl back to 8080 - from 81 (oops)
  Also, add support for allowing people to specify a
  different port on the command line but still use the
  rest of the URL specified in the WSDL.  Not totally thrilled
  with this but it works - any better ideas?
  
  Revision  Changes    Path
  1.3       +1 -1      xml-axis/java/samples/stock/GetQuote.wsdl
  
  Index: GetQuote.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote.wsdl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GetQuote.wsdl	2001/10/04 17:25:09	1.2
  +++ GetQuote.wsdl	2001/10/05 13:06:22	1.3
  @@ -46,7 +46,7 @@
     <!-- service decln -->
     <service name="GetQuoteService">
       <port name="GetQuote" binding="tns:GetQuoteBinding">
  -      <soap:address location="http://localhost:81/axis/servlet/AxisServlet"/>
  +      <soap:address location="http://localhost:8080/axis/servlet/AxisServlet"/>
       </port>
     </service>
   
  
  
  
  1.7       +10 -8     xml-axis/java/samples/stock/GetQuote1.java
  
  Index: GetQuote1.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote1.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GetQuote1.java	2001/10/05 10:55:14	1.6
  +++ GetQuote1.java	2001/10/05 13:06:22	1.7
  @@ -78,7 +78,17 @@
       public  String symbol ;
       
       public float getQuote (String args[]) throws Exception {
  +      // Define the service QName and port QName
  +      /////////////////////////////////////////////////////////////////////////
  +      QName servQN = new QName("urn:xmltoday-delayed-quotes","GetQuoteService");
  +      QName portQN = new QName("urn:xmltoday-delayed-quotes","GetQuote");
  +
  +      Service service = new Service( new URL("file:GetQuote.wsdl"), servQN );
  +      Call    call    = service.createCall( portQN, "getQuote" );
  +
         Options opts = new Options( args );
  +      opts.setDefaultURL( call.getTargetEndpointAddress() );
  +      call.setTargetEndpointAddress( new URL(opts.getURL()) );
   
         args = opts.getRemainingArgs();
   
  @@ -86,14 +96,6 @@
           System.err.println( "Usage: GetQuote <symbol>" );
           System.exit(1);
         }
  -
  -      // Define the service QName and port QName
  -      /////////////////////////////////////////////////////////////////////////
  -      QName servQN = new QName("urn:xmltoday-delayed-quotes","GetQuoteService");
  -      QName portQN = new QName("urn:xmltoday-delayed-quotes","GetQuote");
  -
  -      Service service = new Service( new URL("file:GetQuote.wsdl"), servQN );
  -      Call    call    = service.createCall( portQN, "getQuote" );
   
         // Define some service and Axis specific properties
         ////////////////////////////////////////////////////////////////////////
  
  
  
  1.17      +14 -4     xml-axis/java/src/org/apache/axis/utils/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Options.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Options.java	2001/10/02 15:01:31	1.16
  +++ Options.java	2001/10/05 13:06:22	1.17
  @@ -74,6 +74,7 @@
               Category.getInstance(Options.class.getName());
   
       String  args[] = null ;
  +    URL     defaultURL = null ;
   
       //////////////////////////////////////////////////////////////////////////
       // SOASS (Start of Axis Specific Stuff)
  @@ -94,6 +95,7 @@
        */
       public Options(String _args[]) throws MalformedURLException {
           args = _args ;
  +        defaultURL = new URL("http://localhost:8080/axis/servlet/AxisServlet");
           
           ///////////////////////////////////////////////////////////////////////
           // SOASS
  @@ -129,6 +131,14 @@
           ///////////////////////////////////////////////////////////////////////
       }
   
  +    public void setDefaultURL(String url) throws MalformedURLException {
  +        defaultURL = new URL(url);
  +    }
  +
  +    public void setDefaultURL(URL url) {
  +        defaultURL = url ;
  +    }
  +
       /**
        * Returns an int specifying the number of times that the flag was
        * specified on the command line.  Once this flag is looked for you
  @@ -270,15 +280,15 @@
           tmp = isValueSet( 'p' ); if ( port == null ) port = tmp ;
           tmp = isValueSet( 's' ); if ( servlet == null ) servlet = tmp ;
   
  -        if ( host == null ) host = "localhost" ;
  -        if ( port == null ) port = "8080" ;
  -        if ( servlet == null ) servlet = "/axis/servlet/AxisServlet" ;
  +        if ( host == null ) host = defaultURL.getHost();
  +        if ( port == null ) port = "" + defaultURL.getPort();
  +        if ( servlet == null ) servlet = defaultURL.getFile();
           else
               if ( servlet.length()>0 && servlet.charAt(0)!='/' ) 
                   servlet = "/" + servlet ;
   
           if (url == null) {
  -            if (protocol == null) protocol = "http";
  +            if (protocol == null) protocol = defaultURL.getProtocol();
               tmp = protocol + "://" + host ;
               if ( port != null && !port.equals("-1")) tmp += ":" + port ;
               if ( servlet != null ) tmp += servlet ;
  
  
  

Mime
View raw message