AmazAgent

AmazAgent

Well the Amazon agent (AIM: AmazAgent) is still working this morning/afternoon - I was pretty sure it would be since it's a lot simpler than the BlogAgent which has got a lot of stuff going on inside. I thought at first that the Amazon Agent was not going to be very useful because the documentation says that the SOAP service doesn't support multiple keywords. But in actuality, it does. Nice!

To use the agent type "help" which will give you a list of "modes" you can use for searching like "books", "baby", "music", etc. Simply type the mode and the search term and it'll bring back results. For example "books java" will bring back 10 books on Java (not sure the order that Amazon returns them). You can also separate your search terms with a space to narrow down your search. For example type "books java SOAP Axis" and you'll get the one Axis book that's on Amazon right now. Neato.

I'm also a little confused over the generated code that the Axis creates for the Amazon stuff. KeywordRequest.java and AuthorRequest.java are two different classes which have 95% the same code in them, except that the first has a keyword field that you have to populate for the search and the second has the author field. There's no shared interfaces or parent classes, though. So in my code, I can't get a reference to a generic object, called for example "Request", populate the majority of the fields, and then later below determine what type of Request it is and populate the remaining fields. I actually have to duplicate my code in a big if statement. If you look at the sample code from Amazon, this is basically how they do it too, but they just separate the Requests out into separate classes (again having no relation to eachother!).

This code is all generated from the WDSL generator in Axis. Can I touch this code? I'm not sure what Axis is doing... If I go charging in there and start making changes to the Amazon classes, will it break? I guess I need to spend a little time on the Jakarta project site to get a better idea of what's going on behind the scenes.

By the way, I'm really not sure if I'm going to continue to beat on the BlogAgent stuff. It really doesn't excite me all that much trying to track down instant message errors in wacky libraries. The AOL libraries are great, but the rest just suck. I'm going to put them down for a while and work on something else. That's why I love Ant, by the way, because it's so easy to come back to a project a month or so later and continue where you left off without much problem.

It's a beautiful Sunday in Madrid. Hot as all get out, but gorgeous. Everyone in the city is on their vacations so the normally peaceful and quiet Sunday is like a day in the country now. You can hear birds chirping and the wind blowing but no people or cars... it's really nice. August is even better... it's like a ghost-town in Madrid from day one. Best time of the year in my opinion.

-Russ

< Previous         Next >