Using Axis 1.4
Download and Install
Download and Install
JDK -
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
-- Use default path for the installation
-- Use default path for the installation
axis-bin-1_4.zip or axis-src-1_4.zip
http://archive.apache.org/dist/ws/axis/1_4/
-- Unzip and place axis-1_4 in
C:\
SET Environment Variables
Select Start -> Control Panel
-> System -> Advanced -> Environment Variables -> System Variables
set JAVA_HOME="C:\Program
Files\Java\jdk1.8.0_25"
set PATH=%JAVA_HOME%\bin;%PATH%
set
AXIS_HOME="C:\axis-1_4"
CLASSPATH = C:\axis-1_4\lib
Create Input and Output Folders
Create c:\wsdl folder and place
the wsdl file provided
Create c:\output folder for Java
code generation
Command to execute
C:\axis-1_4\lib>java
-classpath
activation.jar;mailapi.jar;axis.jar;jaxrpc.jar;saaj.jar;commons-logging-1.0.4.jar;commons-discovery-0.2.jar;wsdl4j-1.5.1.jar;log4j-1.2.8.jar;
org.apache.axis.wsdl.WSDL2Java -s C:\wsdl\<WDSL_NAME>.wsdl
-o C:\output -p <PACKAGE_NAME> -t
- Unable to find required
classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart).
Attachment support is disabled.
C:\axis-1_4\lib>
Note – ignore the above error which is underlined.
More info on the command params for reference -
-s Generate sync style code only (Default: off).
Takes precedence over -a.
-o Specify a directory path for the generated code.
-p Specify a custom package name for the generated
code.
-t Generate a test case for the generated code.
------------------------------------------------------------
Implementation –
------------------------------------------------------------
Once we have the Java code generated from the WSDL. We
will have to create a command implementation that will invoke the webservice by
passing the request parameters. The request params for the Headers
and Body will be purely based on the WDSL provided.
------------------------------------------------------------
Testing -
By passing –t as parameter to the above command Junit test
case will be generated which can be used for Unit Test.
------------------------------------------------------------
Using Axis2
Using Axis2
set ANT_HOME=C:\apache-ant-1.8.2
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25
set PATH=C:\apache-ant-1.8.2\bin;C:\Program Files\Java\jdk1.8.0_25\bin
set ANT_OPTS=-Xms256M -Xmx512M
URL -
http://localhost:8080/axis2/services/
Command to generate Code
C:\axis2-1.6.2\bin\wsdl2java.bat -uri <WSDL_PATH> -d adb -s -ss -sd -ssi -o <OUT_PUT_FOLDER_PATH>\service
C:\axis2-1.6.2\bin\wsdl2java.bat -uri <WSDL_PATH> -d adb -o <OUT_PUT_FOLDER_PATH>\client
- Once the files are generated - Create a Client file - to invoke the webservice by setting the request params for the SOAP request.
- Use the file with name < ..Skeleton.java> to write the Business logic for the response SOAP request.
No comments:
Post a Comment