Thursday, March 30, 2006

 

eBay the next generation

Hello once again!

I know two posts in one day, does this guy ever do any work? I assure you I do and this is what this post is going to be about. Specifically the newest incarnation of the eBay web service api. I have written a few small applications now that use the ebay api (of which I will now refer to it as epita - [eBays Pain In The Ass]). Now, I will start by saying that I respect ebay for their service and the fact that they even opened up an api. What I do not respect is the fact that they appear to have their heads up their asses. The reason I say this is that although the api documentation is LARGE it says very little. As a developer I like to hit up a doc, find the section of intrest (say, GetSearchResults) and have all the detail I need to make it work for me in that section. Instead ebay has felt the need to thoughly spread the knowlage of how to use a simple REST request like GetSearchResults accross five different documents some of which are legacy documents that will be invalid in a few months as their Unified Schema take a full hold of their service.

I suppose that I am probably asking too little of the system to take advantage of the extensive documentation provided. What ever. The other last pain in the ass thing about ebay and their api is the frigin account integration stuff. You need a Developer Id, Application Id, Certificate, REST Token, Authentication Token, Developer User Id, and Ebay User Id just to attempt at using the api. I think that is a little too much by itself but on top of that you also need to a second set of the credentials above to use their sandbox server. Stupid? I thought so. But who am I? Just the poor sap trying to use their product.

Ok so thats my rant about what I dont like about it so how do I use it?

Well, my method is like this:

1. Grab the schema definition (its an XSD)
2. Create an ant task in my eclipse project to generate the XML bindings from the XSD using JAXB

=================================
target: generate.xmlbinding.ebay
================================= -- /> name="generate.xmlbinding.ebay" depends="clean" description="-- Generates the jaxb binding classes" />
Ebay US Class Generation -- /> file="${dir.schema}/ebaySvc.xsd" todir="./JavaSource"/ />
dir="./JavaSource/com/project/component/ebay/xmlbinding"/ />
level="info" Parsing Ebay Unified Schema... /> jar="${libs.dir}/${lib.jaxb.xjc}" failonerror="true" dir="./JavaSource" fork="true" /> value="-Xmx1000M"/ /> value="-quiet"/ /> value="-p"/ /> value="com.projectcomponent.ebay.xmlbinding"/ /> file="./JavaSource/ebaySvc.xsd"/ /> /> file="./JavaSource/ebaySvc.xsd" /
/>
This creates my XML bound classes for unmarshalling the api call results.

3. Build a suitable wrapper and service class for myself and make the REST calls
4. Bind the results to the correct generated class
5. Serve up with a beer to the end user.

Its simple and it works. I can go into more detail only if there is intrest so leave comments.


Technorati Tags: , , , , ,

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?