Check if a webservice exists

最后都变了- 提交于 2019-12-12 10:43:57

问题


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.


回答1:


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#?




回答2:


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



来源:https://stackoverflow.com/questions/10088950/check-if-a-webservice-exists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!