This has been discussed before.
To my knowledge, there is no direct API in Axis 1.x or Axis2 that you
can call to do this. But, since it is a servlet, creating a GET request
and sending it and looking for the expected response will work. Then the
discussion moved onto whether this is acceptable in general, since http
may not always be the transport protocol. I also suggested writing a
very simple ping() method and put it into your web service interface,
but that's no different than calling any other method except it should
be quick and easy.

You could try this sort of thing as well:

...
public static boolean isWebServiceAvailable() {
boolean result = false;

MyWebService_ServiceLocator locator = new MyWebService_ServiceLocator();
  try {
    java.lang.String url = locator.getMyWebServiceAddress();
    java.net.URL netUrl = new java.net.URL(url);
    java.net.URLConnection connection =
(java.net.HttpURLConnection)netUrl.openConnection();
    connection.connect();
    result = (connection.getContent() != null) ? true : false;
  }
  catch (java.io.IOException ioe) {
    System.out.println("Caught an io exception: " + ioe.getMessage());
  }
  return result;
}

-jeff




-----Original Message-----
From: Roman Heinrich [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 26, 2007 2:44 AM
To: axis-user@ws.apache.org
Subject: Re: finding if a service is up

Sorry, i`m not familiar with axis2, i`m using axis 1.4.
But if axis2 has similiar architecture (activating web services trough 
servlet), then i think, that axis2 api has not functionality to do it.
But maybe you can try http client library in java.

Eric Nygma wrote:
> I am sorry I didn't describe my question correctly. Apart from trying 
> the wsdl uri on the browser , Can I do this programmatically with some

> axis2 api ?
>
> Thanks.
> e\
>
> On 6/26/07, *Roman Heinrich* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Eric Nygma wrote:
>     > Hi,
>     > Given a wsdl uri, how can I determine using Axis2 whether the
>     services
>     > mentioned in the wsdl are up or not ?
>     > Thanks,
>     > e\
>     if you`ll try for instance
>     http://localhost:8888/MyApp/services/MyService?wsdl
>
>     and the wsdl will be generated, then the service is up.
>
>     Regards,
>     Roman Heinrich
>
>
---------------------------------------------------------------------
>     To unsubscribe, e-mail: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     For additional commands, e-mail: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to