[an error occurred while processing this directive]
> developer > web app development
Consume an Amazon Web Service Using exteNd Workbench
by Philip Proto, Principal QA Engineer , Novell
Date Created: 2002-07-29 13:11:00.000
  Getting Started
  Software Requirements
  Integrate to a web service using an existing wsdl
  Modifying the generated client
  Compiling the generated client
  Running the test client

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.

getting started
Workbench overview
http://developer.novell.com/extend/workbench

Workbench Web Services Tutorial
http://devcenter2.silverstream.com/help/workbench40/docs/help/framesets/tutwbsPreface.fs.html

Workbench Web Services Wizard Help
http://devcenter2.silverstream.com/help/workbench40/docs/help/framesets/toolsWebServiceWizard.fs.html

Software Requirements
Download the exteNd Workbench 4.0 software from the following URL
http://developer.novell.com/ndk/unsupported.htm#exworkbench

integrate to a web service using an existing wsdl
  1. From the workbench menu select File->New Project
  2. Select JAR (Java Archive)
  3. 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.
  4. Click Next->Finish
  5. From the workbench main menu select File->New
  6. Click WebServices tab. Select Existing Web Service
  7. Enter package name such as for example: com.sample.test
  8. Click Next
  9. Enter location of wsdl file (an URL that points to the wsdl): http://xml.amazon.com/schemas/AmazonWebServices.wsdl
  10. Click Next
  11. 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
  1. From the eXtendWorkbench main menu select Project->Project Settings
  2. Select Classpath/Dependencies tab
  3. Click Add Entry
  4. 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"
  5. Click OK
  6. Click OK at the Project Setting dialog
  7. From the main toolbar click the Build project and create archive icon.
  8. 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.
  1. From the main exteNd Workbench menu select Project->Run Web Service Client Class
  2. 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