Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added an Ant example.

...

Option

Interpretation

-?

Displays the online help for this utility.

-help

-h

-o

Specifies the name of the generated WSDL file.

--databinding

Specify the data binding (aegis or jaxb). Default is jaxb for jaxws frontend, and aegis for simple frontend.

-frontend

Specify the frontend to use. jaxws and the simple frontend are supported.

-wsdl

Specify to generate the WSDL file.

-wrapperbean

Specify to generate the wrapper and fault bean

-client

Specify to genearte generate client side code

-server

Specify to genearte generate server side code

-cp

Specify the SEI and types class search path of directories and zip/jar files.

-soap12

Specifies that the generated WSDL is to include a SOAP 1.2 binding.

-t

Specifies the target namespace to use in the generated WSDL file.

-servicename

Specifies the value of the generated service element's name attribute.

-v

Displays the version number for the tool.

-verbose

Displays comments during the code generation process.

-quiet

Suppresses comments during the code generation process.

-s

The directory in which the generated source files(wrapper bean ,fault bean ,client side or server side code) are placed.

-classdir

The directory in which the generated sources are compiled into. If not specified, the files are not compiled.

-portname

Specify the port name to use in the generated wsdl.

-createxsdimports

Output schemas to separate files and use imports to load them instead of inlining them into the wsdl.

-d

The directory in which the resource files are placed, wsdl file will be placed into this directory by default

classname

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.

Anchor
usingant
usingant

Using java2ws with Ant

The java2ws command can be wrapped inside an Ant target as shown below:

Code Block
xml
xml

<?xml version="1.0"?>
<project name="cxf java2ws" basedir=".">   
   <property name="cxf.home" location ="/usr/myapps/cxf-trunk"/>
   <property name="build.classes.dir" location ="${basedir}/build/classes"/>

   <path id="cxf.classpath">
      <pathelement location="${build.classes.dir}"/>
      <fileset dir="${cxf.home}/lib">
         <include name="*.jar"/>
      </fileset>
   </path>
      
   <target name="cxfJavaToWS">
      <java classname="org.apache.cxf.tools.java2ws.JavaToWS" fork="true">
         <arg value="-wsdl"/>
         <arg value="-o"/>
         <arg value="hello.wsdl"/>
         <arg value="service.Greeter"/>
         <classpath>
            <path refid="cxf.classpath"/>
         </classpath>
      </java>
   </target>
</project>

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.)