what is web method attribute in web service?
Asked Answered
H

3

2

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?

Haunted answered 7/8, 2009 at 7:15 Comment(2)
similar one here. https://mcmap.net/q/369041/-webmethod-vs-scriptmethodTaphole
A note: all of these attributes are used with ASMX web services. Microsoft has recently stated that ASMX web service technology is a legacy technology, and has stated that they will not be fixing bugs in that code.Koy
S
7

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"

Stepsister answered 7/8, 2009 at 7:18 Comment(0)
T
1

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.

Taphole answered 7/8, 2009 at 7:17 Comment(0)
A
1

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)

Ashore answered 7/8, 2009 at 7:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.