I am using JAX-WS 2.2.5 framework for calling WebServices. I want to identify the special case when the call fails because the Web Service is down or not accessible.
In some calls, i get a WebServiceException.
catch(javax.xml.ws.WebServiceException e)
{
if(e.getCause() instanceof IOException)
if(e.getCause().getCause() instanceof ConnectException)
// Will reach here because the Web Service was down or not accessible
In other places, I get ClientTransportException (class derived from WebServiceException)
catch(com.sun.xml.ws.client.ClientTransportException ce)
{
if(ce.getCause() instanceof ConnectException)
// Will reach here because the Web Service was down or not accessible
What's a good way to trap this error?
Should I use something like
catch(javax.xml.ws.WebServiceException e)
{
if((e.getCause() instanceof ConnectException) || (e.getCause().getCause() instanceof ConnectException))
{
// Webservice is down or inaccessible
or is there a better way of doing this?