-

vampirical

Coding while you sleep

SOAPy

May 19, 2004 — Okay this is a mixed geek and non geek thread. The results I would think are interesting to non-geeks while the methods are probably not. I'll concentrate mainly on the former rather than the latter to keep the sports fans happy.

I recently discovered the wonders which are possible through Amazon.com's AWS program, Amazon Web Services. Through SOAP (Simple Object Access Protocol, which is an XML protocol) you can retrieve just about anything you would like from their product databases. After a few minutes finding the correct packages to add xml support to my apache install and finding the correct include for php (I'll assume nobdoy is interested enough for links to any of this, correct me if I'm wrong) I started recoding one of the small sidebar features on my site. I've had a subheading entitled "Read" on my site for awhile now in which I post books I've read or am currently reading. Before I had to enter all the data with the script only really generating a link or two from the provided data (amazon.com referal links) but now I only enter the ISBN of the book (which amazon nicely reuses instead of coming up with it's own product ID) and short blurb and now I've got it generating the same little secition effortlessly plus the full listing is now amazingly awesome. Amazon provides 3 different images of the cover in varying sizes as well as the publishing info, title, authors, et al. I've yet to do anything really fun with the data yet except to revamp the list of books.

Coding wise the only interesting issues which came up were handling multiple authors and dealing with the occiasional special character (this still isn't done but it's at least visibly fine). Other than that I've only really translated a few bits of data to suite my needs (like the published date which is presented from their db is quite an ungainly way). The way I organized the system is that after the data is entered on the posting page the amazon db is accessed, the data is retrieved and stored in my db almost exactly as presented and the data is then extracted normally later. I'm sure the SOAP standard would allow for a more XML approach to dealing with the data and I'm sure I could also bypass my own database and access everything directly from amazons but this was just the first way that came to me and it seemed to make sense.

I'm thinking of creating an extension of this which would probably focus mainly on video games and gadgets. If I actually got any traffic I would be making something like 15% off any amazon purchases from the links generated through this method but alas (sp?) 15% of nothing is nothing. I think it would be interesting to see something like this happen with MBoffin.com, I know I would definately take a higher than usual interest in a book/gadget/appliance/etc which had impressed MBoffin.

Note: I think all the writing energy which should be going into the essay I'm prepping for my History final on Friday has spilled over into this post. And now after having previewed it I'm sure that somebody will read this thing and develop a deathwish against me for having wasted so much of their time.

Wirehead says:

Actually, that sounds really cool. I must confess that to me it sounded like the descriptions of the internal workings of a cold-fusion laser device (in that I don't really understand anything to do with web-coding, HTML or whatnot) but the end product seems neat.

DataBind() says:

To be exact, SOAP is not an XML protocol. It is an XML-based protocol. It's used to basically encode response and request messages to and from Web Services.

To be clearer, XML is used to tag the data, and SOAP is used to transmit it.

peterman says:

Now if we could just use XML to tag our satellite-based photoelectric array generated electricity, and transmit it using SOAP to LA, we'd be set!

DataBind() says:

And use the power to generate television camaras for the media.

vampirical says:

Okay now I have a problem. Should I be in essence caching the amazon.com database at the time of posting a new book to then be displayed later or should the amazon db be consulted each time that any sort of variable data (such as price) needs to be accessed?

vampirical says:

Okay I've answered my own question by testing both of my schemes. Accessing amazon's database simply takes to much time to be used to generate the page on the fly when it's not especially needed.

I feel like I need something more than the blurb and publisher info though. I've considered a rating system but the norm would always be 4 or 5 stars. Instead I've decided that the fact of their being there is high marks enough and I'll just explicity state when something sucked. So what else should there be? Maybe a "Similar" entry that's content should be obvious.

Post A Reply:





Sorry, but before you can reply you must either log in or sign up.