Welcome Guest!
Create Account | Login
Locator+ Code:

FTPOnline Channels Conferences Resources Hot Topics Partner Sites Magazines About FTP RSS 2.0 Feed

email article
printer friendly
get the code
more resources

Building a Web Services Conduit
Create a proxy object that allows object-oriented access to Web services data
by Dan Wahlin

December 2002 Issue

When it comes to Web-based companies, Amazon.com needs no introduction. In operation since 1995, it's one of the oldest and biggest online retailers, selling an enormous amount of products including books, movies, toys, and more. With the introduction of the Amazon.com Web service, external Web sites can now tie into Amazon's collection of products using either HTTP/XML or Simple Object Access Protocol (SOAP). This ability allows product data to be integrated into a site while still maintaining the site's unique look and feel. The service includes the capability to search across products based on such criteria as ASIN/ISBN number, product name, author, browse ID, Listmania ID, and keyword. Products can even be added directly to an Amazon.com shopping cart, wedding list, or registry.

Why would you be interested in tying into the Amazon.com Web service? First, the service provides an excellent example of sharing data between distributed applications and demonstrates the power of Web services. Any language and platform capable of working with either HTTP/XML or SOAP can access the service. If that doesn't excite you, think of this: When used in conjunction with the Amazon.com Associate Program (see Resources), individuals and companies alike can leverage the service to make money by directing Web site visitors to different Amazon.com products. (See the sidebar "Consuming Amazon's Web Services" for examples of how companies are leveraging the Amazon.com Web Service on an enterprise level to sell products directly from their Web sites).

Tying into the Amazon.com Web service involves signing up and obtaining a "developer token" from the Amazon.com site (www.amazon.com/webservices). This token will be sent with each request to the service. Although not required, a Web service toolkit also can be downloaded from the site. At this time, the toolkit does not contain any .Net-specific samples but does contain the Web Services Description Language (WSDL) document for the service as well as many other sample XML, XSLT, Java, and Perl files that can help you get familiar with what the service offers.

Hitting the Web service using the HTTP/XML option provides a simple way to obtain product data in an XML format that can then be transformed into HTML (or other formats) using XSLT. Hitting it with the SOAP option allows the Web service to be accessed through SOAP requests and responses and provides a more object-oriented way to integrate the data into your site.

I'll focus on how to send SOAP requests to the service and handle the responses. Specifically, you'll see how to create a proxy object that can simplify interacting with the service and demonstrate how the proxy can provide object-oriented access to the return data. We can use the proxy in an ASP.Net User Control class that can be added easily into any ASP.Net Web site. If you're not familiar with user controls, you can think of them as being object-oriented include files.

Back to top

Java Pro | Visual Studio Magazine | Windows Server System Magazine
.NET Magazine | Enterprise Architect | XML & Web Services Magazine
VSLive! | Thunder Lizard Events | Discussions | Newsletters | FTPOnline Home