|
|

[an error occurred while processing this directive]
|
 |
 |
Here is a brief description of the few easy steps required to build and run a Web Service client that consumes Amazon Web Service using the exteNd Workbench. All you need to do is download and install the Workbench, run its Web Service wizard, modify the generated test class and run it. Estimated time after the software is installed is 5 minutes.
 |
integrate to a web service using an existing wsdl |
 |
 |
 |
- From the workbench menu select File->New Project
- Select JAR (Java Archive)
- Enter project name: AmazonWebService and select a location for the project by either entering the full pathname or by using the browse button to select a location.
- Click Next->Finish
- From the workbench main menu select File->New
- Click WebServices tab. Select Existing Web Service
- Enter package name such as for example: com.sample.test
- Click Next
- Enter location of wsdl file (an URL that points to the wsdl):
http://xml.amazon.com/schemas/AmazonWebServices.wsdl
- Click Next
- Click Finish
The exteNd Workbench tool will now generate java code stubs that are required when interfacing to the existing web service. When the code generation is completed click on the dialog box's OK button.
|
 |
 |
modifying the generated client |
 |
 |
 |
The following client class will be generated: AmazonSearchPortClient.java
Modify the process() method of that class as follows:
public void process(String[] args) throws Exception
{
AmazonSearchPort remote = getRemote(args);
// System.out.println("Test Result = " +
// remote.artistSearchRequest(com.sample.test.ArtistRequest));
//
// Sample using artist search request API
// Dump details of product returned from Amazons web service.
ProductInfo productInfo = null;
final String devTag = "DIBLHQV6QXF19"; // your dev tag
productInfo = remote.artistSearchRequest(new ArtistRequest("Madonna", "1",
"music", "webservices-20", "lite", devTag, "1.0") );
//
// Dump some data from Amazons database
for(int index = 0; index < productInfo.getDetails().length; index++)
{
System.out.println("URL : " + productInfo.getDetails()[index].getUrl() +
"\nAsin : " + productInfo.getDetails()[index].getAsin() +
"\nProduct name : " + productInfo.getDetails()[index].getProductName() +
"\nCatalog : " + productInfo.getDetails()[index].getCatalog() +
"\nKey Phrases : " + productInfo.getDetails()[index].getKeyPhrases() +
"\nRelease Date : " + productInfo.getDetails()[index].getReleaseDate() +
"\nManufacturer : " + productInfo.getDetails()[index].getManufacturer() +
"\nDistributor : " + productInfo.getDetails()[index].getDistributor() +
"\nList Price : " + productInfo.getDetails()[index].getListPrice() +
"\nOur Price : " + productInfo.getDetails()[index].getOurPrice() +
"\nUsed Price : " + productInfo.getDetails()[index].getUsedPrice() +
"\nRefurbushed Price : " + productInfo.getDetails()[index].getRefurbishedPrice() +
"\n");
}
}
|
 |
 |
compiling the generated code and modified client |
 |
 |
 |
- From the eXtendWorkbench main menu select Project->Project Settings
- Select Classpath/Dependencies tab
- Click Add Entry
- Click Browse and navigate to the eXtendWorkbench/compilelib directory. Select all of the following files (%SILVERSTREAM_XWB_HOME% is your Workbench install directory)
"%SILVERSTREAM_XWB_HOME%\compilelib\jaxm-api.jar" "%SILVERSTREAM_XWB_HOME%\compilelib\jaxp-api.jar"
"%SILVERSTREAM_XWB_HOME%\compilelib\jaxrpc-api.jar" "%SILVERSTREAM_XWB_HOME%\compilelib\jbroker-web.jar"
"%SILVERSTREAM_XWB_HOME%\compilelib\saaj-api.jar" "%SILVERSTREAM_XWB_HOME%\compilelib\saaj-ri.jar"
"%SILVERSTREAM_XWB_HOME%\compilelib\xerces.jar"
- Click OK
- Click OK at the Project Setting dialog
- From the main toolbar click the Build project and create archive icon.
- In the lower pane of the main eXtendWorkbench window all files should be compiled and a BUILD SUCCESSFUL message should be generated.
|
 |
 |
running the test client |
 |
 |
 |
At this point you are ready to run the test client.
- From the main exteNd Workbench menu select Project->Run Web Service Client Class
- Click Run on the Web Service Client Runner dialog
Sample output:
URL : http://www.amazon.com/exec/obidos/redirect?tag=webservices-20%26
creative=DIBLHQV6QXF19%26camp=2025%26link_code=sp1%26path=ASIN/B000002LND
Asin : B000002LND
Product name : The Immaculate Collection
Catalog : Music
Key Phrases : null
Release Date : 08 December, 1990
Manufacturer : Warner Brothers
Distributor : null
List Price : $18.98
Our Price : $13.49
Used Price : null
Refurbushed Price : null
|
 |
|
 |
 |
 |