Partager via


<add> Element for <protocols>

Adds a specified protocol that an ASP.NET Web service can use to receive request data sent from a client and return response data. A protocol can be used to associate request data with a method and its parameters and to associate response data with the method and its return value.

<add name="protocol name"/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

name

Required attribute.

The name of the protocol to add.

name Attribute

Value Description

HttpGet

  • Adds the HTTP GET protocol. Method parameters are passed in the query string that is appended to the HTTP request URL, in the form ?name1=value1&name2=value2…. The return value is placed in the body of the HTTP response as a simple XML document (no <soap:Envelope>).

HttpPost

Adds the HTTP POST protocol. Method parameters are passed in the body of the HTTP request, in the form name1=value1&name2=value…. The return value is placed in the body of the HTTP response as a simple XML document (no <soap:Envelope>).

HttpSoap

Adds the HTTP SOAP protocol. A SOAP message is sent in the body of the HTTP request; the SOAP response is sent in the body of the HTTP response.

Documentation

Adds the special Documentation protocol. When this protocol is enabled and the .asmx page is requested directly, ASP.NET runs a helper page to create a documentation HTML page that is delivered to the requesting client.

Child Elements

None.

Parent Elements

Element Description

configuration

The root element in every configuration file used by the common language runtime and .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section. Contains configuration elements that configure ASP.NET Web applications and control how the applications behave.

webServices

Controls the settings of Web services deployed using ASP.NET and of Web service clients running on the .NET Framework.

protocols

Specifies the protocols that an ASP.NET Web service can use to receive request data sent from a client and return response data. A protocol can be used to associate request data with a method and its parameters and to associate response data with the method and its return value.

Remarks

All four possible protocols make use of HTTP/1.1 (Hypertext Transfer Protocol) as their transport. Literally, the HttpGet and HttpPost protocol values use the GET and POST methods of HTTP. The HttpSoap value also uses the POST method, but without the traditional HTTP POST semantics used by an HTML form.

Example

The following example enables all four supported protocols.

<configuration>
   <system.web>
      <webServices>
         <protocols>
            <add name="HttpSoap"/>
            <add name="HttpPost"/>
            <add name="HttpGet"/>
            <add name="Documentation"/>
         </protocols>
      </webServices>
   </system.web>
</configuration>

See Also

Reference

<webServices> Element
<protocols> Element

Other Resources

ASP.NET Configuration Settings
XML Web Services Created Using ASP.NET and XML Web Service Clients
ASP.NET Configuration