Thursday, March 15, 2012

Open Spring-Hibernate Discussion

This post is completely dedicated to discussion on Spring framework.

Tuesday, March 15, 2011

Create a webservice client for ebay shopping apis through eclipse helios


The steps involved to create the webservice client for ebay shopping apis are as follows:

1- Create Standalone Java Project for example ShoppingAPIJavaClient as project name.
2-Include JAX-WS 2.1 java library
3-Create eBay Shopping Web Service Client(through wizard given under eclipse).
Make sure that you are giving ebay shopping apis wsdl as below:
http://developer.ebay.com/webservices/latest/ShoppingService.wsdl.

After completion of 3rd step you will see a package created on your project like eBLBaseComponents.apis.ebay which will have all the apis that will be used by webservice client.

6-Get the app_id from developer center of ebay.

5-Now create simple java client that will access the ebay shopping apis:

public class EbayClient {
private static final String APPID =
"YOUR_APP_ID";//this you can get after developer center registration
private static final String CALLNAME = "FindItems";
private static final String VERSION = "711";
private static final String BASEURL="http://open.api.ebay.com/shopping?";

private static BindingProvider bp;
public static void main(String[] args) {
String endpointURL = BASEURL+"callname=" + CALLNAME+"&version="+VERSION+"&appid=" + APPID;

try { // Call Web Service Operation

eBLBaseComponents.apis.ebay.Shopping service = (Shopping) new ShoppingLocator();
System.out.println ( " EndpointURL2 : " + endpointURL);
eBLBaseComponents.apis.ebay.ShoppingInterface port = service.getShopping(new java.net.URL(endpointURL));

// initialize WS operation arguments here
eBLBaseComponents.apis.ebay.FindItemsRequestType findItemsRequest = new eBLBaseComponents.apis.ebay.FindItemsRequestType();
findItemsRequest.setQueryKeywords("iphone");
// process result here
eBLBaseComponents.apis.ebay.FindItemsResponseType result = port.findItems(findItemsRequest);
System.out.println ( " EndpointURL : " + endpointURL);
System.out.println("Status = "+result.getAck());
System.out.println("Number of total Items= "+result.getTotalItems());
System.out.println("Search Result URL = "+result.getItemSearchURL());

} catch (Exception ex) {
ex.printStackTrace();
}


}

}

This will give you the CLI output like:
EndpointURL2 : http://open.api.ebay.com/shopping?callname=FindItems&version=711&appid="YOUR_APP_ID"
EndpointURL : http://open.api.ebay.com/shopping?callname=FindItems&version=711&appid=
"YOUR_APP_ID"
Status = Success
Number of total Items= 419342
Search Result URL = http://search.ebay.com/ws/search/SaleSearch?DemandData=1&fsop=32&satitle=iphone


Wednesday, December 1, 2010

------For Liferay portlet users only--------------
If we want to change the root context to any new context then we need to follow the following steps.

To change the context of applicaion from ROOT to :

*Override the portal.ctx property in portal-ext.properties to point to your-.

*Override the path property in portal-ext.properties as given default.landing.page.path=/new_context/web/guest/home

*Rename the config file in conf/catalina/localhost to your"new_context.xml".

*Renaming webapps/ROOT directory to webapps/new_context