Consuming Web services with Axis

Part of BookMARC's TVS Model papers.

Axis is a SOAP compliant Java package. Axis is available at http://ws.apache.org/axis/index.html.

To consume the Web services we are going to use the WSDL2Java Axis tool. The purpose of this tool is to create the Java code from a WSDL.

In this case we are going to use WSDL2Java to create only the client bindings:

  1. Download Axis and extract it into a folder
  2. Add Axis to your classpath
  3. Execute the following command, in the command line: java org.apache.axis.wsdl.WSDL2Java -o . (WSDL-file-URL)
  4. Add the generated files to a Java project. The WSDL2Java will generate the following files:
    • A Java class for each data type
    • An interface that is used to access the operations of the service
    • An interface for the service
    • A stub class that contains the code which turns the methods invocations into SOAP calls
    • A service implementation (the locator)
  5. See the services description bellow for some code examples

Monitoring

Axis includes a TCP monitor that can be used to monitor the SOAP calls to the services. See the next steps to know how to use the Axis TCP monitor.

  1. Make sure Axis is in your classpath
  2. Execute the following command, in the command line: java org.apache.axis.utils.tcpmon
  3. In the admin tab add the following values:
    1. Listen port# - select a local port to be monitored (example: 9090)
    2. Target hostname - sirius.bn.pt
    3. Target port# - 80
    4. Click Add
  4. The monitor is ready, now a litle change to the generated code must be done:
    1. Open the Locator class and change the Search_address variable value to: http://localhost:9090/sirius/sirius2.exe
    2. Now we can see the SOAP request and the service SOAP response

Get Record by ISBN

Input parameters
  • isbn - String
Output parameters
  • marcXML - MarcXML object

Search

Input parameters
  • terms - Array of Strings.
    Each term identifies the search prefix, matches the corresponding value. See the next term list for details:
    • AS - Subject
    • AU - Author
    • DP - Publishing date
    • CDU - Universal Decimal Classification
    • ED - Publisher
    • COL - Series
    • ISBN - ISBN
    • TI - Title
    • empty term - Word search
  • values - Array of Strings.
    The values to search for. Values can be prefixed with logical operators to restrict the search result:
    • < - Lower than
    • > - Greater than
    • = - Equal to
    • <= - Lower than or equal to
    • >= - Greater than or equal to
  • precedences - Array of Integers
  • operators - Array of Strings.
    The pairs term-value are linked by the operator wich assumes the values AND, OR and AND NOT
  • pagesize - Integer. The number of records by page
  • pagenumber - Integer. The page number
Output parameters
  • marcXML - Array of MarcXML object