Walkthrough: AWS: Java Code Sample: Step 1

Step: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | N

1) Requires JDK 1.4.0 and Apache Axis. 

This step is really stating the obvious, isn't it? You get Java from Sun. The Java 2 Platform, Standard Edition (J2SE) is fine for Amazon Web Services (AWS) development. You get Axis from Apache's Web Services Project.

If this is your first time looking at Java then I advise you to install Java first and then head over to the well-written and plentiful newbie tutorials on the Sun site. You will need to know how to compile Java programs, how to run Java programs, how to modify the source code of these programs (i.e. use a text editor) and how to deal with the all important CLASSPATH. You will also need to be passingly familiar with JAR files.

It's probably the case that you're already familiar with Java (I was), but that this is your first time with Axis. Axis is an implementation of SOAP from Apache. Axis is a successor to Apache's earlier SOAP implementation and it is the implementation recommended by AWS.

If you're new to SOAP, don't stress out too much. I think of it as "XML messages over the network". One article calls it a wire protocol. I've heard it described as XML over HTTP. It's a deep technology, with ground breaking ramifications, but for compiling Amazon's sample Java application, the only thing you need to do is extract the distribution into a directory.

This is what that Axis directory should look like:

% pwd
/home/Rick/Java/axis-1_1

% ls
LICENSE  README  docs/  lib/  release-notes.html  samples/  webapps/  xmls/

% ls lib
axis-ant.jar  commons-discovery.jar  jaxrpc.jar       saaj.jar
axis.jar      commons-logging.jar    log4j-1.2.8.jar  wsdl4j.jar

In DOS, the Axis directory would like this:

C:\cygwin\home\rick\Java\axis-1_1>dir

 Volume in drive C has no label
 Volume Serial Number is FFFF-FFFF
 Directory of C:\cygwin\home\rick\Java\axis-1_1\lib
.              <DIR>        02-16-04  9:44p .
..             <DIR>        02-16-04  9:44p ..
AXIS-ANT JAR       385,010  06-13-03 10:27a axis-ant.jar
AXIS     JAR     1,235,721  06-13-03 10:27a axis.jar
COMMON~1 JAR        71,442  06-13-03 10:27a commons-discovery.jar
COMMON~2 JAR        31,605  06-13-03 10:27a commons-logging.jar
JAXRPC   JAR        35,759  06-13-03 10:27a jaxrpc.jar
LOG4J-~1 JAR       352,668  06-13-03 10:27a log4j-1.2.8.jar
SAAJ     JAR        18,501  06-13-03 10:27a saaj.jar
WSDL4J   JAR       113,853  06-13-03 10:27a wsdl4j.jar
         8 file(s)      2,244,559 bytes
         2 dir(s)       19,080.31 MB free

There's no need to go through the entire installation process documented on the Axis web site (although the section "Things you have to know" is well worth reading). All you have to do is download the Axis ZIP file and unzip it into a directory. You only need to follow the Axis installation steps if you're going to write your own web service and you already have an application server (like Tomcat) installed and configured.

If you're new to XML, don't stress out either. The sample Java application and Axis do much to hide the complexity of XML. XML is essentially data which "describes itself". Take a look at this:

<namesp1:AsinSearchRequest xmlns:namesp1="urn:PI/DevCentral/SoapService">
        <AsinSearchRequest xsi:type="m:AsinRequest">
                <asin>B000067RPH</asin>
                <page>1</page>
                <mode>music</mode>
                <tag>webservices-20</tag>
                <type>lite</type>
                <dev-tag>your-dev-tag</dev-tag>
                <format>xml</format>
                <version>1.0</version>
        </AsinSearchRequest>
</namesp1:AsinSearchRequest>

The XML above represents this block of data that is needed for an Amazon ID search:

B000067RPH,1,music,webservices-20,lite,your-dev-tag,xml,1.0

The key to XML is not only do we communicate the data, we communicate "what kind of data it is." The data "music" is "described" as a "mode"-type. The data "your-dev-tag" is "described" as a "dev-tag"-type. And so on. That's really all you need to know if you're new to XML. XML is a deep technology also. There's a lot of details to learn, especially if you'll be writing programs, but since all we're doing is trying to compile and run the sample application, we can move on.

Next
Step: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | N


Rick (rgu@TheWorld.com) Umali
Last Update: 2/24/2004