what is web method attribute in web service?

21,410

Solution 1

WebMethod indicates "the method exposed as part of the XML Web service."
ScriptMethod "Specifies which HTTP verb is used to invoke a method, and the format of the response"

Solution 2

WebMethod attribute identifies this method as a web service method.

The ScriptMethodAttribute attribute is optional.

If a method is not marked with ScriptMethodAttribute, the method will be called by using the HTTP POST command and the response will be serialized as JSON. You cannot override this setting from script.

Solution 3

The WebMethod attribute enables the method to be called through the web service.

The ScriptMethod attribute tells which method should be used to call the method (POST/GET) and with formatting the response should use (JSON or XML)

Share:
21,410
Tushar Maru
Author by

Tushar Maru

Delivery Manager

Updated on September 18, 2020

Comments

  • Tushar Maru
    Tushar Maru over 3 years

    what is web method attribute in web service? fro example

    [WebMethod(EnableSession = true)]
    [ScriptMethod(UseHttpGet = true)]
    public string GetApplicationDomains(string strParameterList)
    {
    
    }        
    

    for what purpose this attributes WebMethod and ScriptMethod are used?