Tuesday, January 7, 2014

Step by Step Setup of eBay Java SDK on Maven

This guide assumes that you are using Eclipse ide with the maven plugin properly configured.

Download the eBay SDK java from their site

Create a new maven project using the maven quickstart archetype


Set the archetype parameters

You should now have a basic maven project. Go to package explorer and delete the App.java file.

Since the basic project does not have a resource folder, we should add one. It should be located on src->main->resources folder:

Highlight the resources folder and add it to the build path as a source folder.


Open the folder where you extracted the contents of your eBay java sdk. For my guide, I used eBaySDKJava849.zip and the folder contents are as follows:

Go to the source/core/ebay/sdk of the extracted sdk folder and copy its contents to the src/main/java/com/ebay/sdk folder of the maven project we made earlier:

Go to the source/wsdl of the extracted sdk folder and copy its contents to the src/main/resources folder of the maven project.
 Go to the build folder of the extracted sdk and copy custom-binding.xml and jaxb-binding.xjb to the root directory of the maven project:

Modify the wsdl location in the custom-binding.xml file. Since the name of the project in this example is ebaysdkcore, our configuration is as follows:
1:  <?xml version="1.0" encoding="UTF-8"?>  
2:  <jaxws:bindings wsdlLocation="../ebaysdkcore/src/main/resources/eBaySvc.wsdl"  
3:       xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"  
4:       jaxb:version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">  
5:       <jaxws:bindings  
6:            node="//xs:complexType[@name='ReviseInventoryStatusRequestType']">  
7:            <jaxws:bindings node=".//xs:any">  
8:                 <jaxb:property name="reviseInventoryStatusRequestTypeAny" />  
9:            </jaxws:bindings>  
10:       </jaxws:bindings>  
11:  </jaxws:bindings>  


Go to the build/maven_build of the extracted sdk and copy the pom.xml and place it on the root directory of the maven project.

Modify the pom.xml file to add this missing dependency:
1:  <dependency>  
2:       <groupId>org.slf4j</groupId>  
3:       <artifactId>slf4j-api</artifactId>  
4:       <version>1.7.5</version>  
5:  </dependency>  

Also modify this section of the pom.xml file:
1:  <binding dir="${basedir}" includes="custom-binding.xml"/>  

and change it into this to include the jaxb-binding.xjb file:
1:  <binding dir="${basedir}" includes="custom-binding.xml,jaxb-binding.xjb"/>  

Open the command window and run the following command:
 set MAVEN_OPTS=-Xmx512m  

This ensures that maven has enough memory to run the build.

Again on the command window, go to the root folder of the maven project and run the command to build the project:
 mvn -e clean package  


Credits to this solution from the eBay developer forum.

Complete source can be view from this repo

9 comments:

  1. Nice Post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog as updated.
    Regards,
    PHP Training Center in Chennai|PHP Course Chennai

    ReplyDelete
  2. I am sure that the informative you shared through your post is useful for people. I am impressed with the way of writing. It kept connected me all the time.Keep up the good work.

    RPA Training in Chennai
    Automation Training in Chennai
    UIPath Training in Chennai

    ReplyDelete
  3. Thanks for giving great kind of information. So useful and practical for me. Thanks for your excellent blog, nice work keep it up thanks for sharing the knowledge.
    AWS Training in Chennai | AWS Training Institute in Chennai

    ReplyDelete
  4. I am really thankful for posting such useful information. It really made me understand lot of important concepts in the topic. Keep up the good work!
    Oracle Training in Chennai | Oracle Course in Chennai

    ReplyDelete
  5. It’s always so sweet and also full of a lot of fun for me personally and my office colleagues to search your blog a minimum of thrice in a week to see the new guidance you have got.
    Best PHP Training Institute in Chennai|PHP Course in chennai

    Best .Net Training Institute in Chennai
    Big Data Hadoop Training in Chennai
    Linux Training in Chennai
    Cloud Computing Training in Chennai

    ReplyDelete
  6. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Python Training in Chennai

    Python Training in Velachery

    Python Training in Tambaram

    Python Training in Porur

    Python Training in Omr
    Python Training in Annanagar


    ReplyDelete