Creating a Consumer Service with Turmeric… [part I]

Posted: March 2, 2011 in eBayOpenSource, SOA, Turmeric, wsdl

HI,

In this post I will show you how to create a new Consumer service with Turmeric Eclipse plugin. I used a wsdl from an existing eBay’s Developer Service.
For general steps and preconditions, please refer to Create a Consumer using Turmeric Eclipse Plugin.

In your Eclipse,  go to File -> new -> other

new Consumer

This is the wsdl I choose:

http://developer.ebay.com/webservices/finding/latest/FindingService.wsdl

As you can see, I set two environments, production and local. This will create two different configuration files, as follows:

Finally, I implemented the Consumer Service. I selected the SharedFindingServiceV1Consumer class as superclass.

(Please take a look at BaseFindingServiceRequest in the wsdl for more info about the needed parameters in your request.)

	public static void main(String[] args) {
		FindItemsByKeywordsRequest req = new FindItemsByKeywordsRequest();
		req.setKeywords("phone");
		
		try {
		FindItemsByKeywordsResponse res;
		
		
		res = new FindingServiceV1Consumer("FindingServiceV1Consumer", "sandbox").findItemsByKeywords(req);
		if(res.getSearchResult()!=null && res.getSearchResult().getItem().size()>0){
			for (SearchItem item : res.getSearchResult().getItem()) {
				System.out.println(item.getTitle());
			}
		}
		
		
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

now ,let’s compile:

 


aja!… that’s because I didn’t compile my FindingServiceV1 project yet. Once I did it, a new jar was created under worspace/FindingServiceV1/target, in my case: FindingServiceV1-1.9.0.jar. We need to add this jar into our local maven repository. Now, let’s try a new Consumer compilation. And this time compiles  :).

Is time to try my classes, “run Consumer, run!!!!”

[ TO BE CONTINUED]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s