• Post Reply Bookmark Topic Watch Topic
  • New Topic

Standalone webservice clients

 
Geetha Gubendran
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to webservice. I have a wsdl file and I would like to generate a client for that wsdl and run it every 24 hours. Can you please direct me to some examples of standalone java client for the webservice?

And also can you please throw some light on how this standalone client can be invoked every 24 hrs?

Thanks and Regards,
Rajshan
 
samarjit samanta
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Web Service Client: if wsdl does not have policies in it then you are lucky. Use JAX-WS that is packed with jdk5+ http://java.dzone.com/articles/jax-ws-hello-world?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+javalobby/frontpage+(Javalobby+/+Java+Zone).
You can also look into
  • Apache Axis2 Web service implementation,
  • Apache CXF which is a spring based web service framework,
  • Metro framework - It uses JAX-WS implementation along with other modules. It gets little nasty because it usually requires later version of JAX-WS which is there in its library, but it conflict with JAX-WS that is built in java. Ways to get around this using endorsed directory is there in tutorials. Seehttp://www.ibm.com/developerworks/java/library/j-jws9.html


  • Running a java program every 24 hours:
    On Windows PC you can use Windows scheduler and run a batch file (.bat) or possibly your java program directly. It gives option to run at what time, everyday, or on a specific day of week, or when your pc boots up.
    On linux you can configure cron to trigger the program.
    Or you may look into quartz scheduler which is basically again a java program so you will need to bring that up everyday, or run it all the time.
     
    Geetha Gubendran
    Ranch Hand
    Posts: 75
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    thanks Samarjit. I prefer either the TimerTask or the quartz. I havenot gone thro' quartz yet. Can you suggest me which one is good and give better performance?
     
    samarjit samanta
    Greenhorn
    Posts: 9
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Quartz http://www.quartz-scheduler.org/overview/features.html as you can see here it's quite complex.
    Jobs are scheduled to run when a given Trigger occurs. Triggers can be created with nearly any combination of the following directives:

    at a certain time of day (to the millisecond)
    on certain days of the week
    on certain days of the month
    on certain days of the year
    not on certain days listed within a registered Calendar (such as business holidays)
    repeated a specific number of times
    repeated until a specific time/date
    repeated indefinitely
    repeated with a delay interval


    Most of these are possible using cron or windows scheduler as well.

    If I were to implement such a thing I would go for either cron or windows scheduler just for simplicity.

    If a more organized approach is required for scheduling

    Job Persistence

    The design of Quartz includes a JobStore interface that can be implemented to provide various mechanisms for the storage of jobs.

    like being able to manipulate the schedule through web front end. Or modifying more often automatically by programs then Quartz would be worth using.


    If your schedule doesn't change often and there is always some intelligent agent like human being is there to do it go for cron or windows scheduling. I have seen cron being used in enterprise applications so do not underestimate its capability.

    Hope that gives you enough grounds to make decision.

    Samarjit


     
    Geetha Gubendran
    Ranch Hand
    Posts: 75
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Samarjit,

    Thanks for it again. I read the quartz timer library and I would like to auto start it. I read that in order for the scheduler to automatically start, one of the requirement given is I need to configure the j2ee container to allow user threads. Do you have any idea on this also I am facing an issue with webservice client, can you please look at the posting

    http://www.coderanch.com/t/516657/Web-Services/java/invoking-standalone-webservice-client

    and help me out if you can?
     
    Lester Burnham
    Rancher
    Posts: 1337
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    A standalone client does not run in a JEE container, so it would not be subject to any of its requirements. At least that's the usual definition of a "standalone client". If yours works differently, please provide more detail about that.
     
    Geetha Gubendran
    Ranch Hand
    Posts: 75
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Lester,

    Thanks for your reply. These are 2 different things, Standalone client, am not running as part of JEE container but I ran the tool WSDL2Java and got all my necessary files such as service locator, sample client and everything. I am trying to run this client out of JEE container by setting all the necessary jar files in the classpath from Websphere installation directory. When I run this client, I am getting an error which is what I have shown in the link,


    http://www.coderanch.com/t/516657/Web-Services/jav...g-standalone-webservice-client


    2nd Issue: When I was looking into Quartz scheduler, I came to know that we can write either servlet or EJB to do our task and get this task automatically started but the requirement is we need to configure the j2ee container to allow user threads.

    Hope this explains in a better way.

    Thanks and Regards,
    Geetha.
     
    Lester Burnham
    Rancher
    Posts: 1337
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I'm unclear about how exactly you're trying to run the WS client, but it sounds as if it will indeed be from within a JEE container (so, not standalone), so I can't comment on that.

    If Quartz poses a problem, you can use the java.util.Timer and TimerTask classes for scheduling.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!