How to: |
In order for a Java program to communicate with a Web Service, the Web Services Description Language (WSDL) file must first be consumed. This means that the consumption process would read the WSDL file and create all the necessary classes and code to be used within the Java development environment. There are tools available which perform this consumption process. A commonly used tool is Apache Axis.
You can download Apache Axis from www.apache.org or use the version of Axis that is installed with ReportCaster. For details about consuming a Web Service using Apache Axis, see How to Consume a Web Service Using Apache Axis.
Perform the following steps to consume a Web Service using Apache Axis:
SET WF=C:\ibi\WebFOCUS77\webapps\webfocus\WEB-INF\lib\ SET AXISJARS=%WF%axis.jar SET AXISJARS=%AXISJARS%;%WF%axis-ant.jar SET AXISJARS=%AXISJARS%;%WF%commons-discovery.jar SET AXISJARS=%AXISJARS%;%WF%commons-logging.jar SET AXISJARS=%AXISJARS%;%WF%jaxrpc.jar SET AXISJARS=%AXISJARS%;%WF%log4j-1.2.l4.jar SET AXISJARS=%AXISJARS%;%WF%mail.jar SET AXISJARS=%AXISJARS%;%WF%activation.jar SET AXISJARS=%AXISJARS%;%WF%saaj.jar SET AXISJARS=%AXISJARS%;%WF%wsdl4j-1.5.1.jar java -classpath %AXISJARS%; org.apache.axis.wsdl.WSDL2Java -v -s -p javademo WebFocus.wsdl
where:
The first line points to the location of the Axis .jar files.
Is the name of the package that will contain the Java code.
Is the name of the WSDL file that was saved after being created with the WSDL creation utility. Ensure that the path to this file is correct.
In the following example, a sub-directory called javademo is created containing the Java code to call the Web Service functions.
SET WF=C:\ibi\WebFOCUS77\webapps\webfocus\WEB-INF\lib\ SET AXISJARS=%WF%axis.jar SET AXISJARS=%AXISJARS%;%WF%axis-ant.jar SET AXISJARS=%AXISJARS%;%WF%commons-discovery.jar SET AXISJARS=%AXISJARS%;%WF%commons-logging.jar SET AXISJARS=%AXISJARS%;%WF%jaxrpc.jar SET AXISJARS=%AXISJARS%;%WF%log4j-1.2.l4.jar SET AXISJARS=%AXISJARS%;%WF%saaj.jar SET AXISJARS=%AXISJARS%;%WF%mail.jar SET AXISJARS=%AXISJARS%;%WF%activation.jar SET AXISJARS=%AXISJARS%;%WF%wsd14j-1.5.1.jar java -classpath %AXISJARS%; org.apache.axis.wsdl.WSDL2Java -v -s -p javademo WebFocus.wsdl
WebFOCUS |