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


J2EE portability
Rebuilding the JAX-WS Web services Samples
Getting started
Identifying the directory structure of the Samples build
Rebuilding and reinstalling the JaxWSServicesSamples.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 on operating systems such as AIX or Linux, 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 JAX-WS Samples

Every WebSphere 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, the gallery you see is the same. However, there is one difference. When you click sample_name > Build with Ant > platform > Rebuilding and installing the file, the instructions to rebuild the EAR file are specific to your platform.  Because text files in an EAR file such as XML, xmi, or JavaServer Pages (JSP) files, 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 the sample applications. On the Install Sample Applications panel, select Install the sample applications.

Make a backup copy of the <profile_root>/samples/src/JaxWSServicesSamples 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/JaxWSServicesSamples Contains the sample source code for the Ping, Echo and MTOM Samples.
<profile_root>/samples/lib/JaxWSServicesSamples Contains the Web archive (WAR) files, the Java archive (JAR) files, and the final JaxWSServicesSamples.ear file for Samples. This directory is created after this sample is rebuilt.
<profile_root>/samples/javadoc/JaxWSServicesSamples Contains the Samples Javadoc documentation. This directory is created after this sample is rebuilt.
<profile_root>/samples/bld/JaxWSServicesSamples Contains the generated class files. These class files are used to generate the final JaxWSServicesSamples.ear file. This directory is created after this sample is rebuilt.

Rebuilding and reinstalling the JaxWSServicesSamples.ear file

The JAX-WS 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.

Running the Samples build script

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

Running the Samples build script

To rebuild the JAX-WS WebServices Samples EAR file, perform the following steps:

  1. Verify that <profile_root>/bin is in your PATH environment variable.
  2. Change to the <profile_root>/samples/src/JaxWSServicesSamples directory.
  3. Run the Samples build script.
    • On Windows platforms, type buildJaxWSSamples at the the command line.
    • On platforms such as AIX or Linux, type buildJaxWSSamples.sh at the command line.

The Sample is now built.

The buildJaxWSSamples scripts are located in the <profile_root>/bin directory. The scripts set the appropriate class path information and run the Ant build utility. The Ant utility reads the build.xml files, which describe how to build the Samples. Refer to the Apache Ant Web site for additional documentation on the Ant utility.

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 JaxWSServicesSamples.ear file

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

  1. Locate the rebuilt EAR file in the <profile_root>/samples/lib/JaxWSServicesSamples directory.
  2. Open an FTP session to the WebSphere Application Server for z/OS from the development platform.
  3. Change to the <profile_root>/samples/lib/JaxWSServicesSamples directory.
  4. Delete the existing JaxWSServicesSamples.ear file. Type the command: del JaxWSServicesSamples.ear
  5. To transfer the file in binary format, tsype the command: bin
  6. Move the rebuilt JaxWSServicesSamples.ear from your development platform to the target application server. Type the command: put JaxWSServicesSamples.ear
  7. End the FTP session. Type quit.

Removing and reinstalling the JaxWSServicesSamples.ear file

By default, the JAX-WS 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-WS 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('JaxWSServicesSamples')" 

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

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

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

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

      wsadmin -conntype none -lang jython -c "AdminApp.install('JaxWSServicesSamples.ear',
                  ['-appname', 'JaxWSServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>' ] )"
                
      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('JaxWSServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>' ] )"
                
      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('JaxWSServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>' ] )"
                
      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('JaxWSServicesSamples.ear',
                  ['-appname', 'WebServicesSamples', '-usedefaultbindings', '-node', '<node>', 
                  '-server', '<server>' ] )"
                
      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-WS Web services Samples application. You can configure and run the Ping, Echo and MTOM Sample clients.