0

I am using c# vs 2008. I need to call a web service URL in c#. I need to list the methods in a check box in windows application,

for eg. i am calling http://localhost:l222/Test.asmx

It has three methods.

GetUserDetails
GetCompanyName
GetCustomerDetails

I need to list the webmethod in a check box.

Is it possible in C#

user386258
  • 1,933
  • 8
  • 22
  • 28

2 Answers2

1

Pull the WSDL. It is a xml document. You can use XDocument class to parse it and list the methods. See Parse Complex WSDL Parameter Information

Community
  • 1
  • 1
Muhammad Hasan Khan
  • 34,648
  • 16
  • 88
  • 131
0

Every asmx web service has what's called the Web Service Definition, accessed by appending ?wsdl to the web service URL. Once you have and understand this, you can use the code posted by Mike Hadlow: http://mikehadlow.blogspot.com/2006/06/simple-wsdl-object.html

..to get the methods and their parameters. He uses the built-in System.Web.Services.Description.ServiceDescription class to build another class called WebServiceInfo to get the information you require.

Ryan Shripat
  • 5,574
  • 6
  • 49
  • 77