Export (0) Print
Expand All

Exploring XML Web Service Content

The .asmx file represents the addressable entry point for XML 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 XML 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 XML 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 XML Web service description document.

To access the Service help page

  • In your browser's Address field, type the base URL for the XML Web service by using this format:
    http://servername/projectname/xmlwebservicename.asmx
    
    ParameterValue
    servernameThe server on which the XML Web service resides.
    projectnameThe name of the project for your XML Web service and any additional directory information needed to access the .asmx file for your XML Web service.
    webservicename.asmxThe name of the .asmx file for the XML Web service.

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

    http://localhost/XmlWebService1/Service1.asmx
    

Service Method Help Page

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

The page provides the ability to invoke the method using the HTTP-POST protocol. However, the XML 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 XML Web service method supports.

Service Description

The Service Help page also provides a link to the XML Web service's service description, which is a formal definition of the XML 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 XML 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 XML Web service and provide the WSDL query string by using this format:
    http://servername/projectname/xmlwebservicename.asmx?WSDL
    
    ParameterValue
    servernameThe server on which the XML Web service resides.
    projectnameThe name of the project for your XML Web service and any additional directory information needed to access the .asmx file for your XML Web service.
    webservicename.asmxThe name of the .asmx file for the XML Web service.

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

    http://localhost/XmlWebService1/Service1.asmx?WSDL
    

Accessing XML Web Services from a Web Browser

You can access an XML Web service that supports the HTTP-GET protocol from a Web browser. By default, XML 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 an XML Web service from a Web Browser

  • In your browser's Address field, type the base URL for the XML Web service with the method name and parameters in the query string by using the following format:
    http://servername/projectname/xmlwebservicename.asmx/methodname?parametername0=value0&parametername1=value1&...&parameternamen=valuen
    
    ParameterValue
    servernameThe server on which the XML Web service resides.
    projectnameThe name of the project for your XML Web service and any additional directory information needed to access the .asmx file for your XML Web service.
    webservicename.asmxThe name of the .asmx file for the XML Web service.
    methodnameThe case-sensitive name of the Web method.
    parameternameThe names of the Web method parameters.
    valueThe URL encoded values of each of the Web method parameters.

    For example, to access the ReturnThisString method of an XML 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:

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

See Also

Creating XML Web Services in Managed Code | XML Web Service Description

Show:
© 2014 Microsoft