Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Schedule Web services client

CglrSep 17 2013 — edited Sep 18 2013

Hi,

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

                     src.divaStock

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();

        if(args.length==0){

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

        }else {

            if(KALEM_KARTI.equals(args[0])){

                StockObj[] stockObjs = {};

                StockObj stockObj = new StockObj();

                try {                

                    stockObjs = db.getKalemKartiObj_v2();

                } catch (Exception e) {

                    e.printStackTrace();

                }

                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("javax.xml.rpc.session.maintain",Boolean.TRUE);

                        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) {

                        e.printStackTrace();

                    }         

                }

            }else{

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

            }

        }

        System.exit(0);

    }

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 16 2013
Added on Sep 17 2013
1 comment
244 views