Share via


How to: Explore Web Service Content

 Windows Communication Foundation Services and ADO.NET Data Services

The .asmx file represents the addressable entry point for Web services created with managed code. How you access this file through HTTP determines the type of response received.

Service Help Page

When called from a Web browser without supplying a recognized query string, the .asmx file returns an automatically generated Service help page for the Web service. This is the equivalent of doing an HTTP GET on the .asmx file.

This Service method help page provides a list of the methods the Web service provides and that you can access programmatically. This page contains links for each method that will take you to additional information about that method. In addition, this page contains a link to the Web service description document.

To access the Service help page

  • In your browser's Address field, type the base URL for the Web service by using this format:

    https://servername/projectname/webservicename.asmx
    

    Parameter

    Value

    servername

    The server on which the Web service resides.

    projectname

    The name of the project for your Web service and any additional directory information needed to access the .asmx file for your Web service.

    webservicename.asmx

    The name of the .asmx file for the Web service.

    For example, to access a Web service named Service1.asmx that is part of a project named WebService1 on your local machine, you would enter the following:

    https://localhost/WebService1/Service1.asmx
    

The Service method Help page provides additional information that relates to that particular Web service method.

The page provides the ability to invoke the method using the HTTP-POST protocol. However, the Web service method must support the HTTP-POST protocol to enable this functionality.

At the bottom of the page, the Service method help page provides sample request and response messages for the protocols the Web service method supports.

Service Description

The Service Help page also provides a link to the Web service's service description, which is a formal definition of the Web service's capabilities. The service description is a document that uses the Web Services Description Language (WSDL) grammar. The service description defines the contract for the message formats clients need to follow when exchanging messages with the Web service. For more information, see XML Web Service Description.

To access the service description

  • In your browser's Address field, type the base URL for the Web service and provide the WSDL query string by using this format:

    https://servername/projectname/webservicename.asmx?WSDL
    

    Parameter

    Value

    servername

    The server on which the Web service resides.

    projectname

    The name of the project for your Web service and any additional directory information needed to access the .asmx file for your Web service.

    webservicename.asmx

    The name of the .asmx file for the Web service.

    For example, to access the service description of a Web service named Service1.asmx that is part of a project named WebService1 on your local machine, you would enter the following:

    https://localhost/WebService1/Service1.asmx?WSDL
    

Accessing Web Services from a Web Browser

You can access a Web service that supports the HTTP-GET protocol from a Web browser. By default, Web services that you create in Visual Studio by using the ASP.NET Web Service project template support HTTP-GET, HTTP-POST, and HTTP-SOAP. Not all protocols can support all methods. In general, the HTTP-GET and HTTP-POST protocols are more restricted than HTTP-SOAP in the data types they can support.

To access a Web service from a Web Browser

  • In your browser's Address field, type the base URL for the Web service with the method name and parameters in the query string by using the following format:

    https://servername/projectname/webservicename.asmx/methodname?parametername0=value0&parametername1=value1&...&parameternamen=valuen
    

    Parameter

    Value

    servername

    The server on which the Web service resides.

    projectname

    The name of the project for your Web service and any additional directory information needed to access the .asmx file for your Web service.

    webservicename.asmx

    The name of the .asmx file for the Web service.

    methodname

    The case-sensitive name of the Web method.

    parametername

    The names of the Web method parameters.

    value

    The URL encoded values of each of the Web method parameters.

    For example, to access the ReturnThisString method of a Web service named Service1.asmx with a parameter named MyString set to a value of "This is my test string" and that is part of a project named WebService1 on your local machine, you would enter the following:

    https://localhost/WebService1/Service1.asmx/ReturnThisString?MyString=This+is+my+test+string
    

See Also

Other Resources

Creating Web Services in Managed Code

XML Web Service Description