Last night, for no apparent reason, I decided to dig into the Amazon Web Services API and see if I could do anything fun or cool. So after downloading the SDK and getting my developer token, I set out to get things going. Unforunately, my task was much tougher that it really should have been.
First, I needed to download Axis, the Apache SOAP library. Not that big of a deal but it's not like you just have the axis.jar. You also have 6 support jars which go with it. That becomes a problem when the instructions to run the Java example code just says to do: javac *.java after running the WSDL2Java class. Of course, you can't run that class until you have all of the Axis jars in your CLASSPATH. Being the lazy bum that I am, I decided create a little shell script which would automatically put the jars in my CLASSPATH instead of trying to do it by hand each time.
Here's basically the script:
#!/bin/bash
for i in path/to/*.jar ; do
CP=$i:${CP}
done
javac -classpath $CP *.java
Nothing too earth-shattering there but it got the job done. Well, I should say that it got the job started because unfortunately, there were compile errors with the code that Amazon gave. There were changes in the WSDL which weren't dealt with in the implementation code. Ugh! So after making those changes and getting everything compiled, I was ready to launch this sample app.
Talk about a disappointment. It was just basically a simple UI with lots of text fields with names which weren't exactly easy to figure out. I tried to do a couple of searches but couldn't get any responses other than (it seemed) sample data. So, I did what any self-respecting geek would do, I tried to write my own class which would handle the calling of SOAP.
I copied and pasted code for their Author search and tried again. I still wasn't getting any good data. I looked through the docs but there really wasn't much info to help. There was some stuff on the REST-like query which showed some of the fields which I needed to add. You'd think that in their sample, they would have shown what values some of the fields should be in order for things to work.
So, I made this HashMap:
parameters.put("Host","http://soap.amazon.com/onca/soap");
parameters.put("Author","Jonathan Franzen");
parameters.put("Page","1");
parameters.put("Mode","books");
parameters.put("Tag","webservices-20");
parameters.put("Type","lite");
parameters.put("Dev-Tag","Your Developer token here");
and finally I got data back. You can actually get quite a bit of data back from Amazon for a search so I'm looking forward to tonight to actually do something with this data instead of having to deal with all of the setup/install headache. Hopefully Google will index this and maybe help someone in the future.
Posted by Josh at July 23, 2003 10:41 AM | TrackBackI am walking the same path. where are the jars for this package?
com.amazon.soap.axis.*
I don't see anything in the kit.zip download.
This is the worst SDK I've seen in a while.
Posted by: Jon on February 27, 2004 09:02 AMYou can get the axis files here:
Posted by: Max on March 23, 2004 11:25 AM