Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Clean up your wire protocol with SOAP, Part 2

Use Apache SOAP to create SOAP-based applications

  • Print
  • Feedback
SOAP (Simple Object Access Protocol) is a wire protocol that uses XML for data encoding. It is a minimalist specification of sorts; it only defines the most critical pieces required by a wire protocol, and purposefully omits the details of garbage collection, object activation, and so forth.

SOAP is especially important for Java developers because it adds to Java's value proposition by making platform independence and portability more interoperable. In fact, I would not be surprised if future releases of Java 2 Platform, Enterprise Edition (J2EE) make SOAP one of the mandatory wire protocols that all J2EE-compliant application servers must support. But that's enough speculation for now.

In Part 2 of this four-part series, I will introduce you to Apache's SOAP implementation.

Read the whole series on SOAP:

Introducing Apache SOAP

Apache SOAP, the Apache Software Foundation's implementation of the SOAP specification, is based on IBM's SOAP4J. Like all Apache projects, Apache SOAP is open source and available under the Apache license. I think it is currently one of the best implementations of SOAP. Though Apache SOAP conforms to version 1.1 of the SOAP specification, it lacks support for some features included in SOAP 1.1. (See Resources for a list of Apache SOAP'S available features.)

Download and install Apache SOAP

As I mentioned above, you can download Apache SOAP free of charge. (See Resources for a link.) For my Windows NT laptop, I downloaded the file soap-bin-2.0.zip, which contains Apache SOAP 2.0, the latest version as of this writing. Installing Apache SOAP is a breeze. It consists of three easy steps:

  1. Unzip the downloaded zip file: This results in the creation of a soap-2_0 subdirectory. I unzipped the contents into the root directory of my E drive, so I now have a directory E:\soap-2_0 that contains Apache SOAP.
  2. Set up your Web environment: You will need a Web server that supports servlets and JavaServer Pages (JSPs). At this point, you will fall into one the following two categories:
    • Category 1: You already have a Web server that supports servlets and JSPs, and you feel comfortable configuring it. In this case, set up your Web server so that you can point your browser to http://localhost:8080/apache-soap/. The browser will access the index.html file in the directory soap-2_0 \webapps\soap\.
    • Category 2: You don't have a Web server that supports servlets and JSPs, or you have one but don't want to fool around with it. In this case, I suggest downloading the latest version of Tomcat (3.1 at the time of this writing). (See Resources for a link.) Tomcat is yet another example of the excellent software that Apache creates and makes available for free to the software development community. Once you've downloaded the appropriate zip file (jakarta-tomcat-3.1.1.zip), unzip it. A jakarta-tomcat subdirectory will be created. Once again, I've unzipped the contents into the root directory of my E drive. Add a new context to the jakarta-tomcat\conf\server.xml configuration file like this:

      <Context path="/apache-soap" docBase="E:/soap-2_0/webapps/soap"
               debug="1" reloadable="true">
      </Context>
      


      You will need to replace E: in the docBase attribute of the Context element with the location of your soap-2_0 directory. To start Tomcat, execute the startup.bat (startup.sh for Unix) file. To shut it down, execute the shutdown.bat (shutdown.sh for Unix) file. But wait -- don't start Tomcat just yet.

  • Print
  • Feedback

Resources