[
Download
]
| [
Documentation Home
] | [
Release Note
]
WSDL2Code - Generate Code Starting with a WSDL Document
The aim of this document is to explain briefly how the WSDL2Code code generation tool works.
Content
Introduction
WSDL2Code is a handy tool available with WSO2 Web Services Application Server that
allows the user to generate Java source code for a Web Service or
a Web Service client from a given WSDL.
Usage
Using WSDL2Code is quite straightforward. In fact, as with the other tools
provided on the WSO2 Web Services Application Server front page, you don't even need to
sign in.
Click on
WSDL2Code
and you will be taken to the following screen.
On this screen, you can customize the code generation process to your liking.
The description given against each configuration option should give you
an idea of what it does. Some of the more importants options are described below.
-
uri
: The WSDL to generate code for. Can be given in the form of a Web URL
or of a file system path in case you have the WSDL document on the local file system.
-
a
: Check this to generate code that will only enable the service to be invoked
in a non-blocking manner. By default both sync and async style code will be generated.
-
s
: As opposed to the above option, only synchronous (blocking) invocation code will be
generated. In case both "a"
and
"s" are checked, "s" will take precedence over "a"
and hence only sync style code will be generated.
-
t
: Generate a client-side JUnit test case. This test case can stand on its own, but
it doesn't really do anything except pass default values
(null for objects, 0 or false for primitive types). The generated test case file
could be considered a template that you may fill in.
-
ss
: Generate server side code (i.e. skeletons). Default is off.
-
sd
: Generate the service descriptor (i.e. server.xml). Default is off.
This is only valid when the above option
ss
(server side code generation option) is enabled.
-
d
: Specify which databinding mechanism to use. You can
take your pick from ADB, XMLBeans, JIBX, JAXME, JAXBRI
-
g
: Generate all the classes. This is only valid when the above option
ss
(server side code generation option) is enabled.
When checked, the client code (stubs) will also be generated along with the skeletons.
-
pn
: Specify the port name to be used in code generation.
You need to specify this if the WSDL contains multiple ports and you need to select one.
If the port name is not specified, then the first port (of the selected service) will be picked.
-
u
: Unpack classes. This option specifies whether to unpack the classes
and generate separate classes for the databinders.
-
ns2p
: Specify a comma separated list of namespaces and packages
where the given package will be used in the place of the auto generated package for
the relevant namespace. The list will be the format of ns1=pkg1,ns2=pkg2.
-
uw
: If unwrapping is turned on, in the generated code,
method signatures will contain the inner element values as arguments and return types,
instead of being wrapped inside the container element.
-
Eosv
: Turn off strict validation. This option is applicable
only in case the default databinding, ADB, is used.
For the options that you leave unchanged, the default values will be used
in the generation process. Click on
Generate
.
If everything is in order, i.e. the given WSDL is correct, the generation should happen smoothly
and produce the java code. WSO2 Web Services Application Server will pack up the generated code into a
jar file which will be presented out to be downloaded or saved to your local computer.
if the
ss
option was checked, the generated jar will include the service skeleton
which you can flesh out to execute your desired business logic.
If not, only the client stubs will be generated,
using which you can inboke the service, assuming it has already been deployed.
Conclusion
WSDL2Code provides an easy to configure and easy to use method of producing service and client
code from a given WSDL document.