Java to WS
java2ws - uses a Web service endpoint's implementation (SEI) class and associated types classes to generate a WSDL file, wrapper bean ,server side code to start the web service and client side code.
java2ws -databinding <jaxb or aegis> -frontend <jaxws or simple>
-wsdl -wrapperbean -client -server -ant -o <output-file>
-d <resource-directory> -classdir <compile-classes-directory>
-cp <class-path> -soap12 -t <target-namespace>
-beans <ppathname of the bean definition file>*
-address <port-address> -servicename <service-name>
-portname <port-name> -createxsdimports -h -v -verbose
java2ws uses a Web service endpoint's implementation (SEI) class and associated types classes to generate a WSDL file, wrapper bean ,server side code to start the web service and client side code.
The options used to manage the code generation process are reviewed in the following table.
Displays the online help for this utility and exits.
Specifies the name of the generated WSDL file.
Specify the data binding (aegis or jaxb). Default is jaxb for jaxws frontend, and aegis for simple frontend.
Specify the frontend to use. jaxws and the simple frontend are supported.
Specify to generate the WSDL file.
Specify to generate the wrapper and fault bean
Specify to generate client side code
Specify to generate server side code
Specify to generate an Ant build.xml script
Specify the SEI and types class search path of directories and zip/jar files.
Specifies that the generated WSDL is to include a SOAP 1.2 binding.
Specifies the target namespace to use in the generated WSDL file.
Specifies the value of the generated service element's name attribute.
Displays the version number for the tool.
Displays comments during the code generation process.
Suppresses comments during the code generation process.
The directory in which the generated source files(wrapper bean ,fault bean ,client side or server side code) are placed.
The directory in which the generated sources are compiled into. If not specified, the files are not compiled.
Specify the port name to use in the generated wsdl.
Specify the port address.
Specify the pathname of a file defining additional Spring beans to customize databinding configuration.
Output schemas to separate files and use imports to load them instead of inlining them into the wsdl.
The directory in which the resource files are placed, wsdl file will be placed into this directory by default
Specifies the name of the SEI class.
You must include the
classname argument. All other arguments are optional and may be listed in any order. This tool will search and load the service endpoint class and types classes. Make certain these classes are on the
CLASSPATH or in a location identified through the
-cp flag. If none of "-wsdl , - wrapperbean, -client, -server" flags are specified, java2ws will generate nothing.
java2ws -wsdl -d ./resource org.apache.hello.Greeter
java2ws -cp ./tmp org.apache.hello.Greeter -wsdl
java2ws -o hello.wsdl -wsdl org.apache.hello.Greeter
java2ws -client -server -s ./src org.apache.hello.Greeter
java2ws -wrapperbean -classdir ./classes org.apache.hello.Greeter
Using java2ws with Ant
The java2ws command can be wrapped inside an Ant target as shown below:
Make sure you set the "fork=true" attribute for the <java/> task as shown above. Also, remember to keep each word or flag within the command line options in its own <arg/> element (e.g., do not use <arg value="-o hello.wsdl"/>, but split them up into two <arg/> elements as done here.)
Although we would recommend using Maven, see the antbuild sample in the CXF distribution for an example of using Ant to create a CXF project.
wsdlvalidator and xsd2wsdl.