6

Could someone please be kind enough to show me the best way to determine if a webservice (ASP.NET) exists at a given URL?

I assume an approach will be something along the lines of issuing a request using System.Net.Webclient but how could I determine if it is a valid webservice and what sort of request should I issue?

EDIT: To add a bit more context I am determining if a webservice exists because I am attempting to build a generic tool that uses arbitrary webservices.

Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
  • in order to consume web service, your tool also will need WSDL provided by user. By using WSDL you can determine which functions web service has and you can call it automatically. – adt Apr 10 '12 at 12:50
  • There is no generic way to do this for an arbitrary service. Also, why do you want to be able to call an arbitrary service, when soapUI will do that for you? – John Saunders Apr 10 '12 at 17:27

2 Answers2

4

The only way IMHO to be sure the service is up is to be able to call an innocuous method on the service and verify the response. Retrieving the WSDL is not sufficient.

There is a similar SO question on this here:- How do I test connectivity to an unknown web service in C#?

Community
  • 1
  • 1
Nick Ryan
  • 2,662
  • 1
  • 17
  • 24
0

I would ask for WSDL document. If you get it back it means that the service exists and you can check to WSDL for implemented methods.

Consider reading about WS-Discovery

http://docs.oasis-open.org/ws-dd/discovery/1.1/wsdd-discovery-1.1-spec.html

Jakub Konecki
  • 45,581
  • 7
  • 87
  • 126
  • this is actually not an answer, you say to him, read the manual and the msdn and you find it. Do you know the answer ? – Aristos Apr 10 '12 at 12:53
  • some services might disable exposing wsdl . for ex: security reasons. – adt Apr 10 '12 at 13:01