Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

How to check if webservice is up using axis stub/proxy

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using axis 1.2.1.
There is a webservice I am supposed to consume as a client.
My problem is i need to distinguish between connectivity problems (such as connection refused, time out, etc )and exception thrown by the Web service itself.
This is because I need to retry the webservice call in case it is a connectivity problem and in case it is an exception thrown by the web service, I need to handle it differently (throw out the exception).

Is there any API/method I can use to distinguish connection exceptions?


I have the following piece of code :
Echo_2_0Stub e = null;
try
{
WirelessCSIServiceLocator proxy = new WirelessCSIServiceLocator();
e = (Echo_2_0Stub) proxy.getEcho_2_0_HTTPPort(new URL(
"http://localhost:8080/axis/services/Echo_2_0_HTTPPort"));

EchoRequestInfo er = new EchoRequestInfo();
er.setData("SAMIR");

EchoResponseInfo eresp = e.echo(er);

Call c = e._getCall();
System.out.println("Req is " + c.getMessageContext().getRequestMessage().getSOAPPartAsString());


System.out.println("ERe" + eresp.getData());
System.out.println("ERe" + eresp.getResponse().getCode());
System.out.println("ERe" + eresp.getResponse().getDescription());


}
catch(Exception ex)
{
if(ex instanceof AxisFault)
System.out.println("hai fault axis ka");

Call c = e._getCall();
System.out.println("Req is " + c.getMessageContext().getRequestMessage().getSOAPPartAsString());

if(c.getMessageContext().getResponseMessage()!=null)
{
System.out.println("Req is " + c.getMessageContext().getResponseMessage().getSOAPPartAsString());
}
throw ex;
}
}


Now, is there any way I can check if the service is up before calling EchoResponseInfo eresp = e.echo(er); ?
Or, is there any particular exception/class of exception I can catch, so that I can detect the connection problems?

Any help will be highly appreciated.

Thanks.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My problem is i need to distinguish between connectivity problems (such as connection refused, time out, etc )and exception thrown by the Web service itself.



When there is a "connectivity" problem and the application makes a call on the web service, what happens? What does the web service return?

In regards to exceptions thrown by the web service, what types of exceptions are thrown? What makes these any different than what is returned when there are "connectivity" problems?


 
Basheer Ahmed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
By connectivity problems, I mean exception like Connection refused, connect timed out,page not found etc.
Whereas the web service itself throws an exception like XYZAplicationException (normally an XYZAplicationException will mean that the request has reached the service and the service has returned an exception in the response).
Could you please advice?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When there is a connectivity problem and the application makes a call on the web service, what happens? What does the web service call return?

Or, in other words, when the application makes a call on the web service and there is a connectivity problem, what happens? What does the web service call return?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic