Setting up the java development environment

Background

Axis2 is a tool that allows you to consume web services and create the classes for you that you need to use them.

Download Axis 2 and extract it locally. For purposes of showing a real example, the software is located at /Users/lab10002/Documents/AssetWorks/Training in a folder named axis2-1.6.4

Installing Axis 2:

  • Verify JAVA_HOME is set by going to a terminal or console and typing, echo $JAVA_HOME
  • You should see a path. (e.g.,/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home)
  • If you do not, set your JAVA_HOME.  (e.g. export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home)
  • Verify AXIS2_HOME is set, echo $AXIS2_HOME or set it  (e.g. export AXIS2_HOME=/Users/lab10002/Documents/AssetWorks/Training/axis2-1.6.4)
  • cd $AXIS2_HOME
  • cd bin
  • Execute the build (as root):
    • Option 1 if wsdl is not behind CAS, execute, sh wsdl2java.sh –uri https://uconnapp.assetworks.com:8443/fmax/wsdl/fmax-wsdl.wsdl -o /Users/lab10002/Documents/AssetWorks/Training/jars -d xmlbeans -or

    • Option 2 if wsdl is behind CAS, download wsdl and xsd locally, execute sh wsdl2java.sh –uri file:///Users/lab10002/Documents/AssetWorks/Training/wsdls/fmax-wsdl.wsdl -o /Users/lab10002/aimwebservices -d xmlbeans -or
  • This will build a bunch of jar files and an ant build file that will be executed from Eclipse.
    • If the build fails with a GC Limit Exceeded (or other memory error), edit the wsdl2java.sh/bat and set the maximum memory size explicitly to 4096m.  You may need to add the entire line highlighted below in yellow.
      wsdl2java
  • Open Eclipse and select the location specified after the -o option in the wsdl2java.sh command above:
    Eclipse Open Project
  • (Note the screen shot here is in error mode because the project was already built on the demo machine.  If this is the first build you should not see errors)
  • When the project successfully builds you will see it in the Project Explorer pane of eclipse
  • Double click the build.xml file to open it in the editor.  There are two memory size settings that need to be increased. memoryMaximumSize should be set to 1024m:
     <javac debug="on" memoryMaximumSize="1024m" memoryInitialSize="256m" fork="true" destdir="${classes}" srcdir="${src}">
  • A couple Environment Variables need to be set before the Ant build can execute successfully.  Right click on the project and click the Run As menu and click the External Tools Configurations.
  • These are the same environment variables set early at the command line
  • Save the changes and go back to the Run As and select the Ant Build..
  • Click the Run button
  • After a successful build you should see a message like the one shown here:
  • You should also see the build directory in the project.  If you do not, double click the project folder and select Refresh

 

NOTE: THIS NEEDS TO BE RUN & BUILT EVERY TIME THE WEB SERVICES ARE CHANGED!