• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Run Web Service Method Automatically on Tomcat 7.0

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dears,

1- I created a web service which I want it to run automatically when Tomcat starts. I want to know how I can do this in simple way (as i'm knew in Java development).
2- I want this web service's method to run periodically (every 30sec). What should I do to have this.

I'm using eclipse/Tomcat 7.0,

Appreciate your support as I'm still did not understand the concept of Servlet, and how to use my web service as a servlet. Or if I can't forget about web service and I need something else to have my above requests done.

Thank you,
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web services are not meant to be executed periodically w/o client requests. You should create a pair of java.util.Timer and TimerTask in a ServletContextListener of your web app to do this.

The relationship between web services and servlets is only a loose one - Java webservice stacks are implemented using servlets, but that is hidden from the web service developer.
 
reply
    Bookmark Topic Watch Topic
  • New Topic