Prev | Current Page 766 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

search.msn.com:80/webservices.asmx", IsRequired = true)]
public String LiveSearchWebServiceUrl
{
get
{ return (String)this["LiveSearchWebServiceUrl"]; }
set
{ this["LiveSearchWebServiceUrl"] = value; }
}
}
}
CHAPTER 12 ?–  BUILDING A COMPLEX CONTROL 591
Wrapping the Web Service Proxy in a Utility Method
To make it easier to work with the web service proxy, we wrap the creation and invocation
process inside a utility class that abstracts all the details of communicating with the Live Search
web service, as shown in Listing 12-3. This class also hides the work necessary to grab configuration
information from the custom configuration section we created earlier in this chapter.
Listing 12-3. The SearchUtility.cs Class File
using System;
using System.Configuration;
using System.ServiceModel;
using System.Threading;
using System.Web;
using LiveSearchService;
namespace ControlsBook2Lib.CH12.LiveSearchControls
{
///
/// Utility class for abstracting Live Search web service proxy work
///

public sealed class SearchUtility
{
private const string ConfigSectionName = "controlsBook2Lib/liveSearchControls";
///
/// Static method for searching Live Search that wraps web service
proxy code for easy invocation.


Pages:
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778