Hauri
Hauri

Reputation: 275

Setting Java web service timeout at server side

I'm new to java web services and I'm facing some problems to configure my Java server side application with web services. I'll try to explain it with detail:

  1. I have developed in NetBeans a java web service that receives as input one parameter and outputs another one.
  2. One of my web methods is supposed to perform a highly time and resources consuming operation that involves a big SQL query and a CSV file generation.
  3. As far as I have tested this operation it can easily take between 30 seconds and 5 minutes to run.
  4. The problem is that everything here seems to have a timeout that breaks the whole process: client web service request, web browser, tomcat server and server java web service.

I have two questions: was I right when I said all those parts have a timeout that should be checked and configured? If affirmative, I would like to know where can I modify the timeout value in my web service implementation (I've taken a look to web.xml and sun-jaxws.xml files, but don't know what and where to touch...).

Thank you very much !!

Upvotes: 0

Views: 5746

Answers (1)

azraelAT
azraelAT

Reputation: 762

In Tomcat's server.xml you find a "connectionTimeout" attribute in the "Connector" element, which defines tomcat's timeout range in miliseconds.

But there are cleaner ways of handling resource-consuming tasks for a web service than to just increase timeouts. Think about doing your exhausting stuff in a seperate thread and provide your client a possibility to check whether the thread has finished or not.

Upvotes: 1

Related Questions