Consuming Web services with Axis
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:
- Download Axis and extract it into a folder
- Add Axis to your classpath
-
Execute the following command, in the command line:
java org.apache.axis.wsdl.WSDL2Java -o . (WSDL-file-URL)
- 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)
- 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.
- Make sure Axis is in your classpath
- Execute the following command, in the command line:
java org.apache.axis.utils.tcpmon
- In the admin tab add the following values:
- Listen port# - select a local port to be monitored (example: 9090)
- Target hostname - sirius.bn.pt
- Target port# - 80
- Click Add
- The monitor is ready, now a litle change to the generated code must be done:
-
Open the Locator class and change the Search_address variable value to:
http://localhost:9090/sirius/sirius2.exe
- Now we can see the SOAP request and the service SOAP response
Get Record by ISBN
Input parameters
Output parameters
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
|