0

I have a web application running on an apache tomcat server, it communicates with several web services using jax-ws libraries. I need to create a routine in my tomcat application to test whether the web services is up and running.

I, of course, can invoke any methods the web services have, and check if I get the expected (or any) results, but I am looking for a more elegant way. I am picturing it in a ping-like method scenario, where a servlet can trigger the method. But I don't seem to find that JAX-WS is offering that kind of method.

Thank you.

endiyan
  • 1
  • 4

1 Answers1

1

There's no "ping" concept in SOAP or JAX-WS; though if you own the web service application you could certainly add a ping() method or operation that consumers could invoke.

If you want to periodically check to see if the service provider is reachable, accepting HTTP traffic, and actively has the web service running, you could attempt to fetch the WSDL with a HTTP GET request using java.net.URLConnection.

There's an excellent tutorial here on StackOverflow - you could easily put this sort of code in a servlet. The URL you'd use would look something like http://someserver/WebService?WSDL where http://someserver/WebService is the endpoint URL to your web service provider.

Community
  • 1
  • 1
Scott Heaberlin
  • 3,254
  • 1
  • 21
  • 22
  • > you could attempt to fetch the WSDL with a HTTP GET request using java.net.URLConnection. this is a very good idea. Definitely gonna try this. Thanks! – endiyan Mar 22 '14 at 04:11