File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Basic WebService Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Basic WebService Question" Watch "Basic WebService Question" New topic
Author

Basic WebService Question

Kris Battula
Greenhorn

Joined: Jun 06, 2006
Posts: 10
Suppose i have a webservice deployed in a server, and using JAX-RPC i am trying to invoke the service, my question is what happens is the server is down? if the server is down do i have to code the client in such a way that it should resend the request? please answer?
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
If you are building your own client, then it would probably be good to have a configurable amount of time to wait for a reply, in case the server is busy, and a configurable number of times the client should retry the operation, before failing.

This will depend on the user experience you want to build and the nature of what is being sent over the web service.

If there is a visual screen where a user would be watching a "please wait" message while the service is invoked, it may be better to only try once (withing a configurable timeout), and if that attempt fails, then display a message indicating the connection could not be established because the server appears to be down, and present them with a "retry" button.

If the web service is invoked by a system process, such as a scheduled task, or one that does not have a user interface with it, then automatic retry a couple of times when the server is down may be a good thing, and if after the configured number of retries, log an error message and give up.


Error: Keyboard not attached. Press F1 to continue.
Kris Battula
Greenhorn

Joined: Jun 06, 2006
Posts: 10
can anyone please provide a prototype how this can be done using Jax-Rpc client API? first of all is it possible?
Kris Battula
Greenhorn

Joined: Jun 06, 2006
Posts: 10
Hi, can any body please proivde me a prototype how can i do this using JAX-RPC client API..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
I don't think JAX-RPC lets you set a timeout, so either you need to implement a generic solution (possibly involving a separate thread), or you could use the timeout mechanism of the underlying transport library (which would tie you to that library).

Once you have that, implementing a mechanism to retry several times should be simple.
[ June 07, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Kris Battula
Greenhorn

Joined: Jun 06, 2006
Posts: 10
Hi Ulf,
Could you be more specific, how do i handle this!!
Thanks Bunch!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
Are you asking how you can run a Java thread for a fixed time and then interrupt it, how to set the timout, or how to run the request several times if necessary?

If you're using Axis, you can set the timout either using the WSDL2Java stubs, if that's the type of client you use, or using the Axis MessageContext as described here.
[ June 07, 2006: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic WebService Question