Default language.

Creating an Apache Axis web service client


  1. Create a basic web service named SimpleWebService.
  2. Install JDK 1.8.45 or later.
  3. Ensure that java and javac commands are included in the PATH.
  4. Install Apache Axis 1.x from http://xml.apache.org/axis.
  5. Install Xerces2 Java Parser 2.2.0 from http://xml.apache.org/xerces2-j/index.html.
  6. Install JavaServer Pages 1.2 class files from http://java.sun.com/products/jsp/download.html.

    Note

    This information is provided as a convenience only. For instructions about installing and using Apache Axis, Xerces2 Java Parser, and JavaServer Pages, see the appropriate documentation at http://ws.apache.org/axis/java/index.html, http://xerces.apache.org/xerces-j/api.html, and http://java.sun.com/products/jsp/docs.html respectively.

  7. Set CLASSPATH to include Axis and Xerces JAR files as follows:


    set AXIS_DIR=<axisInstallDir>
    set AXIS_LIB_DIR=%AXIS_DIR%\lib
    set XERCES_DIR=<xercesInstallDir>
    set JSP_DIR=<jspInstallDir>
    set CLASSPATH=.;%AXIS_LIB_DIR%\axis.jar;%AXIS_LIB_DIR%\saaj.jar;%AXIS_LIB_DIR%\ log4j-1.2.4.jar;%AXIS_LIB_DIR%\wsdl4j.jar;%AXIS_LIB_DIR%\commons-discovery.jar;%AXIS_LIB_DIR%\jaxrpc.jar;%AXIS_LIB_DIR%\commons-logging.jar;%XERCES_DIR%\xercesImpl.jar;%XERCES_DIR%\xmlParserAPIs.jar; %JSP_DIR%\servlet.jar
  8. Create a directory for building an Axis web service client (for example, C:\temp\axisclient).
  9. Change directory to C:\temp\axisclient.
  10. At the command prompt, enter the following command:


    java org.apache.axis.wsdl.WSDL2Java -W -p ARWSClient http://<midTierServer>/arsys/WSDL/<arServer>/SimpleWebService

    This command generates proxy classes for writing the client program.

  11. Create a directory for storing the class files (for example, C:\temp\axisclient\classes).
  12. Change directory to ARWSClient.
  13. Create a new file called TestClient.java and add the following lines of code:


    /**
    * TestClient.java
    *
    */
    package ARWSClient;
    import javax.xml.rpc.holders.StringHolder;
    import javax.xml.rpc.holders.CalendarHolder;
    public class TestClient {
    public static void main(String args[]) throws Exception
    {
    SimpleWebServicePortType binding;
    binding = new SimpleWebServiceServiceLocator().getSimpleWebServiceSoap();
    // declare variables
    CreateInputMap createInput = new CreateInputMap();
    // supply values for creating an entry using OpCreate
    createInput.setAssigned_To("Frank");
    createInput.setShort_Description("Testing Axis Client");
    createInput.setStatus(StatusType.New);
    createInput.setSubmitter("Joe");
    // make web service request to create an entry
    CreateOutputMap createOuput = binding.opCreate(createInput);
    System.out.println("Successfully created a request with id: " + createOuput.getRequest_ID());
    // declare additional variables for get operation
    GetInputMap getInput = new GetInputMap();
    getInput.setRequest_ID(createOuput.getRequest_ID());
    ARWSClient.GetOutputMap getOutput;
    getOutput = binding.opGet(getInput);
    System.out.println();
    System.out.println("Following values have been returned by OpGet");
    System.out.println();
    System.out.println("Request_ID : " + getOutput.getRequest_ID());
    System.out.println("Assigned_To : " + getOutput.getAssigned_To());
    System.out.println("Create_Date : " + getOutput.getCreate_Date().getTime());
    System.out.println("Last_Modified_By : " + getOutput.getLast_Modified_By());
    System.out.println("Modified_Date : " + getOutput.getModified_Date().getTime());
    System.out.println("Short_Description : " + getOutput.getShort_Description());
    System.out.println("Status : " + getOutput.getStatus());
    System.out.println("Status_History : " + getOutput.getStatus_History());
    System.out.println("Submitter : " + getOutput.getSubmitter());
    }
    }
  14. Enter the following command:
    javac -d ..\classes *.java
  15. Open the BMC Remedy Mid Tier Configuration Tool, and under WebService Settings, enter an anonymous user name (for example, Demo), leaving the password blank.
  16. Change directory to ..\classes.
  17. Enter the following command to run the client:
    java ARWSClient.TestClient

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*