Check web service is reachable or not


A Developer commented my blog today to ask me this question, how to check efficiently whether our services are up and running.

I have similar style windows notification app (C#), which is running on every hour and making general ping test as below code & gives me report.

Code from my sample -

WebClient client = WebClient.create("http://localhost:8080/ABCService/ABCPort?wsdl");

Response response = client.get();

if (response.getStatus()==200) {

// Web service up and running

} else {

// Web service is down

}

Hope this helps someone else as well. Nothing like fancy code but just sharing Smile 

Happy Coding..!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s