• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Check if web service is running

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created Java Proxy classes from the WSDL generated from a COBOL copy book.
I have the ProxyPort and the Service classes generated.

How do I check if the WEB Service is up and running on the server?

Thanks,
Kani
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you asking because you are the administrator of the server and you want to make sure it is available? Or are you asking because you have written some code which is a client of that web service?
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have written some code which is the client of the web service, have check if the webservice is running and if it is then render the page accordingly.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In that case, you don't have to check whether the web service is running. At least, you don't need a separate step specifically for that. Just connect to the service and send your request. If it isn't running, then you will get an exception.
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's problem I don't get an exception from the web service, and more over if we set a debug on the mainframe side, it actually tries to execute the code.

I access the WS as below:

TestWSPortProxy proxy = new TestWSPortProxy ();
proxy._getDescriptor().setEndpoint("http://110.12.30.45:46379/TestWS");
proxy.getList(comArea);

where TestWSPortProxy is the JAX-WS java proxy generated class and comArea is of type DfhCommarea

so before accessing the WS method getList I want to know if the WS is up and active.

 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no point in that. Consider this series of events:

1. You check to see if the service is running. It is.

2. The service terminates.

3. You try to use the service.

Anyway in the example you sort of described there, the service was indeed running. Otherwise you couldn't have connected to it. So trying to find out whether it was running would not have been of any use.

I suggest you describe your actual problem and let people comment on that, rather than insisting on a proposed solution and making people help you implement that.
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok forget the code, all I want to do is serve as a Java Middleware check if the externally hosted WS is up and running.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So just send it a request, and if it responds then it's running. If this is a legitimate requirement (and as I pointed out already, it isn't a legitimate requirement for clients of the service) then the service will support a "ping" request which you can use.
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi it's me again. I send a request to the webservice just by creating a new instance of the service, but I get the service instance, though I removed the WS from mianframe server.

Thanks in advance.
 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kavi,
To just check if your Web Service is working, try invoking the url in soap:address location attribute of WSDL following by ?wsdl.
For example:
<soap:address location="http://localhost:8080/ABCService/ABCPort"/>
In browser, check if http://localhost:8080/ABCService/ABCPort?wsdl is working. This tells you if web service is really up and running. But, to check if it is servicing your requests, you have to send request messages and see.
 
Maheshwari Kirthi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thank you very much for the reply.

Actually our mainframe server had a wrapper program around the actual web service and was setting a return vaue of -1 in the comm area in case of any exception and not throwing the actual exception.
That's why I was little confused about why my WS request was not behaving as expected on the Java end.

Again thanks Naren and also thank you Paul .

Thanks and Regards,
Kani.

 
Greenhorn
Posts: 6
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use WebClient class to hit wsdl url and capture the status of the response.


 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am writing an application in c# to check if a webservice is running by using webclient class. I want a similar code as yours to check if webservice is alive or not.below is my incomplete code:
namespace ConsoleApplication2
{
class Program
{
public bool checkstatus()
{
WebClient client = new WebClient();
client.set_BaseAddress("http://localhost:33242/Service1.svc?wsdl");
WebResponse response = client. [Method to be used here];

if(response.[Method to be used here]==200)
{
//Web service is up
}
else
{
// Web service is down
}

}


}
}
}

Please respond as soon as possible
 
Abhinav Taduka
Greenhorn
Posts: 6
Hibernate Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am not expert in C#. Following code might work.


 
Sharmilily Sha
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks ... that really worked...
I also want to know how to check if there are any connectivity problems while accessing a database through a web service ..........
and adding the credentials to it while checking
That would be of great help
Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic