How to test a Web Service

The easiest way to test a web service is by running the project.
Make sure that your ProjectName.asmx file is defined as the start page.

The title of the page is the name of the class
The description property of the WebService attribute appears immediately below the title.
You then get a list of available methods with their descriptions below each one.
Not all methods can be tested in this way though.
For example you cannot test methods that take an object or ByRef arguments.

The Service Description link displays the WSDL contract for this web service.
This is an XML file that describes the web service with information about each method and its arguments.
You can browse the WSDL contract for an .asmx page from inside a browser by appending "?WSDL" to the page's URL.

Clicking an any method will allow you to enter the necessary arguments and the result will be returned in XML.


Where does this page come from ?
When intercepts a request for an .asmx page without anything on the query string, it used reflection to extract the attributes and the method names of the first class in the .asmx file.
It then synthesizes the HTML page for you automatically.
Only the first class in this file is visible in a browser.
The page that produces the output is just an .aspx page.
This file is the DefaultWsdlHelpGenerator.aspx file which can be customised if you want to.
Changing this file will affect all the XML web services running on this machine.

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext