As you can see from the previous code example, this is a contact record with two contacts, John Doe Doe. For each contact, a contact type and a first and last name are specified. This XMLdocumentcan be sent to a mainframe, a Windows computer, a UNIX computer, and a Linux computer. All thesecomputers can read it because it is a text file. Invoking an XML Web ServiceAvery important aspect of communicating with a Web service is how you can physically execute a ified function. XMLWeb services are based on standard Internet protocols and allow you to invoke through communication mechanisms such as HTTP-GET, HTTP-POST, or SOAP over HTTP, in more detail in the following sections. Some Web APIs covered in this book, such as Amazon sWeb API, support both the HTTP-GET and SOAPoptions, although others support only one method. Web service providers can enable all three methods, but they typically disable one or more that theydecide are not appropriate or desirable for various reasons. The fact that vendors support differentmethods is the subject of much debate. You should, however, understand how to use each method can work with the various Web APIs that are available. The methods are introduced here, but I them in greater detail in the chapters that follow. Invoking a Web Service Using REST (HTTP-GET) RESTstands for Representational State Transfer.It refers to invoking a Web service using parametersincluded in a URL. REST uses HTTP-GET to retrieve data and is not typically used for data updates. After a request is processed, REST returns an XMLdocument. Let s look at an example of calling an Amazon Web service using REST. Suppose you have thefollowingURL: http://aws- beta.amazon.com/onca/xml?Service=AWSProductData&SubscriptionId=YOUR_ID_GOES_HERE&ItemSearch&SearchIndex=Books&Keywords=Denise%20GosnellNotice how the first part of the URLcontains the traditional domain information. Next, you see the ous parameters being passed. These parameters are being passed to an Amazon API (currently version4.0 beta). The URLincludes a parameter for the service being called (AWSProductData), the subscriptionID (your developer token), the operation to perform (a search), the search index to use (books), and to search on (Denise Gosnell). Parameters are separated by ampersands (&), and spaces areindicated by %20. As you can see, it is really quite easy to call a Web service using REST, if the Web service supports REST. You can then use your programming language of choice to execute the HTTP-GET command containingthe URLand process the XMLfile that is returned. You will see examples of this in action throughoutthebook. It is very easy to test a REST Web service from your Web browser. Pasting the URLlisted previously Web browser returns results similar to those shown in Figure 1-1.3Anatomy
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services