To invoke a method of a Web service, you call the corresponding method of the generated Web service proxy class. The generated proxy class executes a Web request to the Web service method.
Note: |
|---|
For AJAX-enabled ASP.NET applications to call Web services from script, the application must be configured to register the required ASP.NET HTTP handler. For more information, see
Exposing Web Services to Client Script.
|
The Web service that you are calling must be an .asmx file and must be qualified with the ScriptServiceAttribute attribute. Individual methods to be called from script must be qualified with the WebMethodAttribute attribute. Methods without this attribute are not exposed in the proxy class. For more information, see Exposing Web Services to Client Script and Calling Web Services from Client Script.
The proxy class is automatically generated when the ASP.NET Web page is rendered and is derived from the Sys.Net.WebServiceProxy class. The path property of the generated class references the Web service URL.
In your application, you can call the generated proxy class members. Alternatively, you can create instances of the generated proxy class. You can specify a succeeded callback function, a failed callback function, and, optionally, time-out value and user context as default properties for each instance. You can then use these proxy class instances to call Web service methods.