Create Rich Web Apps with AJAX: Listing 2: C#, Call an external Web Service

Wrapping external Web service calls with a local Web service is straightforward. This code demonstrates how a local Web service can act as the middle-man between an AJAX-enabled page and an external Web service.

namespace GolfClubShack { [ScriptService] [WebService(Namespace = "")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class AmazonService : System.Web.Services.WebService { public AmazonService() { // Uncomment the following line if using designed // components //InitializeComponent(); } [WebMethod] public Book[] GetBooks(string searchText,string page) { AmazonSearch search = new AmazonSearch(); return search.SearchBooks(searchText, page, 5); } } }
comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.