The default Http Handler used to process calls is removed and replaced with a Script Handler Factory class located in the System. The request message shown in Listing 2 passes a country parameter with a value of "Belgium" while the response message in Listing 3 passes an array of Customer objects and their associated properties. Web Services can utilize the Script Method attribute with the Use Http Get parameter set to true, which causes parameters to be passed via a the query string parameters. Listing 4 shows an example of applying the Web Method attribute to a method named Get Customers By Country(). Using the Web Method Attribute in a Web Service The Get Customers By Country() method accepts a country parameter and returns a Customer object array.In the next section you'll see how to create Web Services capable of handling JSON request messages and responding with both simple and complex types. NET AJAX framework provides several different ways to call Web Services. NET Web Services since its initial release in 2002 and the ASP. NET 2008 Beta 2 has built-in support for creating Web Service files and automatically derives associated code beside classes from the System. The country value passed into the method is forwarded to a business layer class which in turn calls a data layer class to retrieve the data from the database, fill the Customer object properties with data and return the array. NET framework that provide a cross-platform solution for exchanging data between distributed systems.Although Web Services are normally used to allow different operating systems, object models and programming languages to send and receive data, they can also be used to dynamically inject data into an ASP.NET AJAX Toolkit called the Auto Complete Extender.Topics covered include defining AJAX-enabled Web Services, creating client proxies and calling Web Services with Java Script. NET AJAX Web Service Handler Configuration This Http Handler replacement is made in order to allow Java Script Object Notation (JSON) calls to be made from ASP. NET Web Services using a Java Script Web Service proxy. NET AJAX sends JSON messages to Web Services as opposed to the standard Simple Object Access Protocol (SOAP) calls typically associated with Web Services.The Xml Serialize String property has a default value of false which means that all return types except strings returned from a Web Method are serialized as XML when the the Xml Serialize String property is ignored. Now that you've seen how to create Web Services and make them accessible to ASP.
For example, the Customer Details class shown in Listing 9 contains Address and Gender properties which The Address and Gender objects defined within the Customer Details class shown in Listing 9 won't automatically be made available for use on the client-side via Java Script since they are nested types (Address is a class and Gender is an enumeration). The Get Customers By Country() function is called when an end user clicks a button on the page. It passes a country value obtained from a textbox as well as a callback function named On WSRequest Complete that should be invoked when the asynchronous Web Service call returns.
NET AJAX page or send data from a page to a back-end system.
All of this can be done without resorting to postback operations.
Listing 6 shows an example of using the Script Method attribute with the Use Http Get property. Using the Script Method attribute with the Use Http Get property.
In addition to allowing Web Methods to accept HTTP GET requests, the Script Method attribute can also be used when XML responses need to be returned from a service rather than JSON.