Building the JAX-RPC Web services Samples with the Ant build tool


J2EE portability
Rebuilding the Samples that ship in this gallery
Getting started
Identifying the directory structure of the Samples build
Rebuilding and reinstalling the WebServicesSamples.ear file

J2EE portability

One of the great benefits of developing applications on a J2EE platform is portability.  All of the Sample programs in the Samples Gallery are developed on a workstation and run on z/OS systems without changing one line of Java code.  By building J2EE applications on Intel or UNIX systems, a developer can eliminate the challenges of EBCDIC to ASCII or ASCII to EBCDIC file conversions.  The availability of tools makes it easy for developers to write and test on a development workstation and install the enterprise archive (EAR) files on z/OS systems.

Rebuilding the Samples that ship in this gallery

Every WebSphere Application Server (Application Server) for z/OS customer is entitled to the Application Server media for multiplatforms. If you install the WebSphere Application Server base product and the Samples on one of the platforms supported by this package you see the same gallery. The one exception is that when you click sample_name > Build with Ant > platform > Rebuilding and installing the sample.ear file, you get instructions to rebuild the EAR file on that platform.  Because text files in an EAR file (XML, xmi, JavaServer Pages (JSP) files, and so on) must be in an ASCII format, it is easier to edit those files on an ASCII machine.  If you make changes on an ASCII machine, you can then reinstall the resulting EAR file on the z/OS platform without an EBCDIC to ASCII conversion. 

Getting started

Install WebSphere Application Server on the distributed platform of your choice and indicate to install Application Server Sample applications as well.

Make a backup copy of the <profile_root>/samples/src/WebServicesSamples directory before attempting to modify or rebuild the Samples.

Identifying the directory structure of the Samples build

The Samples are installed in the following directories:

<profile_root>/samples/src/WebServicesSamples Contains the Sample source code for the AddressBook and Stock Quote Samples.
<profile_root>/samples/lib/WebServicesSamples Contains the Web archive (WAR) files, the Java archive (JAR) files, and the final WebServicesSamples.ear file for Samples. This directory is created after the sample is rebuilt.
<profile_root>/samples/javadoc/WebServicesSamples Contains the Samples Javadoc documentation. This directory is created after the sample is rebuilt.
<profile_root>/samples/bld/WebServicesSamples Contains the generated class files. These class files are used to generate the final WebServicesSamples.ear file. This directory is created after this sample is rebuilt.

Rebuilding and reinstalling the WebServicesSamples.ear file

The JAX-RPC Web services Samples Enterprise Archive (EAR) file is provided when WebSphere application server is installed. You do not have to build the Samples before using them. The following directions describe the steps to rebuild the Samples, with additional information for modifications.

Executing the Samples build script

Transferring the rebuilt WebServicesSamples.ear file
Removing and reinstalling the WebServicesSamples.ear file

Executing the Samples build script

To rebuild this Sample, verify that <profile_root>/bin is in your PATH environment variable. Follow these steps to execute the Sample build script, which rebuilds the Sample:

  1. Open a command prompt.
  2. At the command line, change to the <profile_root>/samples/src/WebServicesSamples directory.
  3. Run the Sample build script:
  4. Type buildWebServiceSamples at the the command line.
    • On Windows development platforms, type buildWebServiceSamples at the the command line.
    • On UNIX and Linux development platforms, type buildWebServiceSamples.sh at the command line.

The Sample is now built.

The buildWebServicesSamples.bat and the buildWebServicesSamples.sh script in the <profile_root>/samples/bin/WebServicesSamples directory sets the appropriate class path information and executes the Ant build utility. Ant reads the build.xml files, which describe how to build the Sample. Refer to the Jakarta Web site for additional documentation on Ant.

Important Information During the build process, only class files that have changes are rebuilt. The remaining class files are repackaged into the new EAR file.

Transferring the rebuilt WebServicesSamples.ear file

Use the File Transfer Protocol (FTP) to transfer the binary EAR file to the z/OS server, using the following instructions.

  1. Find the rebuilt EAR file in the <profile_root>/samples/lib/WebServicesSamples directory
  2. Open an FTP session to the WebSphere Application Server for z/OS from the development platform
  3. Change directory to <profile_root>/samples/lib/WebServicesSamples
  4. del WebServicesSamples.ear
  5. bin
  6. put WebServicesSamples.ear
  7. quit

Removing and reinstalling the WebServicesSamples.ear file

By default, the JAX-RPC Web Services Sample installs into the <profile_root>/installedApps/<cell name> directory, where <cell name> is the name of the cell where your application is installed. Reinstall the Sample as described in the following steps:

  1. Stop the application server.
  2. Remove the JAX-RPC Web services Sample EAR file:
    1. Type the following commands:

      cd <profile_root>\bin
      setupCmdLine

      cd <profile_root>/bin
      . ./setupCmdLine.sh

      cd <profile_root>/bin
      . ./setupCmdLine.sh

      cd <profile_root>/bin
      . ./setupCmdLine

      where <profile_root> represents the profile installation directory.
    2. Type the following command to uninstall the application (<profile_root>/bin must be in your PATH):

      wsadmin -conntype none -lang jython -c "AdminApp.uninstall('WebServicesSamples')" 

      wsadmin.sh -conntype none -lang jython -c "AdminApp.uninstall('WebServicesSamples')" 

      wsadmin.sh -conntype none -lang jython -c "AdminApp.uninstall('WebServicesSamples')" 

      wsadmin -conntype none -lang jython -c "AdminApp.uninstall('WebServicesSamples')" 

  3. Reinstall the Sample:
    • Change to the <profile_root>/samples/lib/WebServicesSamples directory
    • Locate the WebServicesSamples.ear file
    • Type the following:

      wsadmin -conntype none -lang jython -c "AdminApp.install('WebServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>', '-deployejb' ] )"
                
      where <node> is the name of node, and <server> is the name of server on which to install the Sample.

      wsadmin.sh -conntype none -lang jython -c "AdminApp.install('WebServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>', '-deployejb' ] )"
                
      where <node> is the name of node, and <server> is the name of server on which to install the Sample.

      wsadmin.sh -conntype none -lang jython -c "AdminApp.install('WebServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>', '-deployejb' ] )"
                
      where <node> is the name of node, and <server> is the name of server on which to install the Sample.
      wsadmin -conntype none -lang jython -c "AdminApp.install('WebServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>', '-deployejb' ] )"
                
      where <node> is the name of node, and <server> is the name of server on which to install the Sample.
  4. Start the application server.

You have now rebuilt and reinstalled the JAX-RPC Web Services Samples application. You can Configure and run the Address Book and Stock Quote sample clients.