Hunting the Web Services at Amazon - Writing Your Application (Page 2 of 4 )
What You Need To Do
The PHP NuSoap class provides a clean and simple way to access Amazon product information using the Amazon SOAP APIs . You will need to install the NuSoap library on your machine. This library can be downloaded from here . Download the file nusoap.php. You will also need free developers token; get it from here , all you need is your email address. Following picture depicts the development process.
Analyze Amazon Web Services
If you are new to Web Services, read introductory articles here . Now, I assume, that you understand the benefits of Web services, lets take a closer look to Amazon.com’s WSDL (Web Service Description Language).
This is nothing but a XML vocabulary and surprisingly simple, though it may look little bully at first look. With this document, we can view Web Service’s function, its location (end point) and special type. Click here to view the WSDL description for Amazon.com.
First, look at the <xsd:complexType> tag. This tag allows Amazon to create new types that provide additional functionality or grouping. In this case, we have an object that stores “Author search” criteria. Each type within this object is a string type. In the above code snippet, the elements wrap to the following keyword data:
Author – the author name used in this search Page – Which page of the search result you would like to see mode – A list of valid store tag – “Webservice-20” this denotes, that this is a web service call type – “lite” or “heavy”, this corresponds with the amount of data you want return devtag – Your unit token (a free token is available at Amazon.com web site)
Another important element in the WSDL is the <message> tag; it provides information about the functions available from Web Services. In the above code snippet, the <part> element represents the parameters for the function named AuthorSearchRequest. You should also notice that we have two separate <message> elements, one named KeywordSearchRequest and the other AuthorSearchResponse. Request should be used when calling the function while response is used to provides the type returned from the function. By combining our <message> and <xsd:complexType> elements, we can understand the function and the parameters it requires.
Write Your Application
Here is the full set of method calls with brief description that you can make remote call from your PHP application: