1 Reply Latest reply: Sep 18, 2013 1:30 PM by dadams07 RSS

    How to Schedule Web services client




      i want to schedule client web services for every day running on 23:00.


      Code is running on Intellij editor. Client web services sends  our inventory codes.


      i have linux server and i can use cron tab. but i don't know, how can run class files as scheduled. 


      Parameter: KalemKart


      Main class: start.ServiceClientStock


      other classes:src.dao




      Code in ServiceClientStock:


      public class ServiceClientStock {


        private static final String KALEM_KARTI = "KalemKart";


      public static void main(String args[]) throws Exception {


              DaoOracle db = new DaoOracle();




                  System.out.println("Enter Services Type:!");


              }else {




                      StockObj[] stockObjs = {};


                      StockObj stockObj = new StockObj();


                      try {                


                          stockObjs = db.getKalemKartiObj_v2();


                      } catch (Exception e) {






                      StockLocator divaStockLocator = new StockLocator();


                      StockSoap_PortType divaStockLocatorImportSoap12 = divaStockLocator.getStockSoap12();


                      StockSoap12Stub is12s = (StockSoap12Stub)divaStockLocatorImportSoap12;


                      String sessionCookie = getSessionCookie();


                      for(int i = 0; i < stockObjs.length; i++){


                          try {




                              is12s._setProperty(HTTPConstants.HEADER_COOKIE, sessionCookie);


                              System.out.println( "stockObj.getStokNo()="+stockObjs[i].getStokNo() );


                              if(stockObjs[i].getStokNo().isEmpty() ){


                                  System.out.println( "No Data Found !!" );


                              } else{                        


                                  String webServiceResult = is12s.addStocks(stockObjs[i]) ;


                                  Integer resultStatus = db.insertLog("AddStocks",stockObjs[i].getStokNo(), webServiceResult);




                          } catch (RemoteException e) {










                      System.out.println("Wrong Services!");









        • 1. Re: How to Schedule Web services client

          The question is vague, but I'll take a stab at it.


          1. One doesn't "schedule" a service. Services run continuously. You can, however schedule a call to a Web service. I assume this is what you're trying to do.


          2. "How can run class files as scheduled." I assume you mean "how do I run my Java program on a schedule?" Answer: Same way you run it manually, via a command line that starts with "Java," followed by the various options> The options which would include the name of a jar, main class, etc. If you don't now how to run a Java program manually, you need to start by by reading up on that.


          Hope this gets you started.