Java Reference
In-Depth Information
WSDL2JAVA tool. With just a few parameters, this program gener-
ates Java beans, services classes, and stubs containing the informa-
tion to connect to the services server. In fact, this tool can be used to
create the skeletons needed to write a Web service provider as well as
a Web service client. We focus on the Web service client here.
The command lines that follow show an example that allowed us
to generate the Java skeleton classes that we use to write our client.
The first command line sets the path location where Axis has been
installed on the software production machine. Then, the list of
needed jar files is provided. Finally, the utility generating Java classes
is executed, provided with the jdm.wsdl file. The option - NStoPkg
allows control of the generated package names without using auto-
matically created names.
set AXIS .\axis\lib\
set AXISJARS %AXIS%axis.jar;%AXIS%jaxrpc.jar;%AXIS%commons-logging-1.0.4.jar;
%AXIS%commons-discovery-0.2.jar;%AXIS%saaj.jar;%AXIS%activation.jar;
%AXIS%j2ee.jar;%AXIS%wsdl4j-1.5.1.jar;%AXIS%mailapi.jar
java.exe -classpath %AXISJARS% org.apache.axis.wsdl.WSDL2Java --NStoPkg
http://www.jsr-73.org/2004/webservices com.MyName.webservices.services --NStoPkg
http://www.jsr-73.org/2004/JDMSchema com.MyName.webservices.beans -o "Java_Source"
"jdm.wsdl"
To use this script, you set the Axis project path (for the Java class
path) and customize the package's name to tune the generated
classes (e.g., by substituting your company name for MyName). The
execution of this command generates a folder named Java_Source (the
folder name can be changed).
The same process can be followed using Apache “ant” with the
following code:
<target name "all" description "Builds the Java classes from wsdl.">
<java classname "org.apache.axis.wsdl.WSDL2Java"
classpathref "axis.classpath" fork "yes ">
<arg value "--NStoPkg" />
<arg value "http://www.jsr-73.org/2004/webservices com.MyName.webservices.
services"/>
<arg value "--NStoPkg" />
<arg value "http://www.jsr-73.org/2004/JDMSchema com.MyName.webservices.
beans"/>
<arg value "--output" />
<arg value "${generated.dir}" />
<arg value "${local.wsdl}" />
</java>
</target>
 
Search WWH ::




Custom Search