Which two actions should you perform?

You are implementing an ASP.NET Web site. The Web site contains a Web service named
CustomerService. The code-behind file for the CustomerService class contains the following code
segment.
public class ProductService : System.Web.Services.WebService
{
public List<Product> GetProducts(int categoryID)
{
return GetProductsFromDatabase(categoryID);
}}
You need to ensure that the GetProducts method can be called by using AJAX. Which two actions
should you perform? (Each correct answer presents part of the solution. Choose two.)

You are implementing an ASP.NET Web site. The Web site contains a Web service named
CustomerService. The code-behind file for the CustomerService class contains the following code
segment.
public class ProductService : System.Web.Services.WebService
{
public List<Product> GetProducts(int categoryID)
{
return GetProductsFromDatabase(categoryID);
}}
You need to ensure that the GetProducts method can be called by using AJAX. Which two actions
should you perform? (Each correct answer presents part of the solution. Choose two.)

A.
Apply the WebService attribute to the ProductService class.

B.
Apply the ScriptService attribute to the ProductService class.

C.
Apply the WebMethod attribute to the GetProducts method.

D.
Apply the ScriptMethod attribute to the GetProducts method.

Explanation:
CHAPTER 9 Working with Client-Side Scripting, AJAX, and jQuery
Lesson 3: Implementing jQuery
Calling a Web Service with $.ajax() (page 535)
CHAPTER 10 Writing and Working with HTTP Modules and Web Services
Lesson 2: Creating and Consuming XML Web Services
Calling a Web Service from Client Script by Using AJAX (page 583-584)



Leave a Reply 0

Your email address will not be published. Required fields are marked *