Save This Page
Home » axis2-1.5-src » samples.quickstart » clients » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements. See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership. The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License. You may obtain a copy of the License at
    9    *
   10    * http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    * Unless required by applicable law or agreed to in writing,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied. See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   package samples.quickstart.clients;
   20   
   21   import samples.quickstart.service.adb.StockQuoteServiceStub;
   22   public class ADBClient{
   23       public static void main(java.lang.String args[]){
   24           try{
   25               StockQuoteServiceStub stub =
   26                   new StockQuoteServiceStub
   27                   ("http://localhost:8080/axis2/services/StockQuoteService");
   28   
   29               getPrice(stub);
   30               update(stub);
   31               getPrice(stub);
   32   
   33           } catch(Exception e){
   34               e.printStackTrace();
   35               System.err.println("\n\n\n");
   36           }
   37       }
   38   
   39       /* fire and forget */
   40       public static void update(StockQuoteServiceStub stub){
   41           try{
   42               StockQuoteServiceStub.Update req = new StockQuoteServiceStub.Update();
   43               req.setSymbol ("ABC");
   44               req.setPrice (42.35);
   45   
   46               stub.update(req);
   47               System.err.println("price updated");
   48           } catch(Exception e){
   49               e.printStackTrace();
   50               System.err.println("\n\n\n");
   51           }
   52       }
   53   
   54       /* two way call/receive */
   55       public static void getPrice(StockQuoteServiceStub stub){
   56           try{
   57               StockQuoteServiceStub.GetPrice req = new StockQuoteServiceStub.GetPrice();
   58   
   59               req.setSymbol("ABC");
   60   
   61               StockQuoteServiceStub.GetPriceResponse res =
   62                   stub.getPrice(req);
   63   
   64               System.err.println(res.get_return());
   65           } catch(Exception e){
   66               e.printStackTrace();
   67               System.err.println("\n\n\n");
   68           }
   69       }
   70   
   71   }

Save This Page
Home » axis2-1.5-src » samples.quickstart » clients » [javadoc | source]