:::: MENU ::::

How to add wsdl2java and java2ws toANT

CXF 2.1 and previous provides ant tasks for wsdl2java and java2ws. These tasks are not in CXF 2.2, since it’s simple enough to use .
The tasks are delivered in a separate jar file: modules/integration/cxf-anttasks-2.1.jar.
Here is a snippet from the wsdl_first_anttask sample provided in the CXF distribution. It shows the declaration of the task jar file via the ant ‘antlib’ mechanisms, and the use of the wsdl2java task.
"hello world demo" default="build" basedir="."
xmlns:cxf="antlib:org.apache.cxf.ant.extensions" >

"../common_build.xml"/>






"antlib:org.apache.cxf.ant.extensions"
resource="org/apache/cxf/ant/extensions/antlib.xml"
classpathref="cxf.anttasks.classpath"/>

"generate.code">
"info" message="Generating code using wsdl2java..."/>
"${build.src.dir}"/>
"${build.classes.dir}"/>
"${wsdl.dir}/hello_world.wsdl"
sourceDestDir="${build.src.dir}"
destDir="${build.classes.dir}"/>




Note you may always use the Ant task directly instead and with the same options as available with the command-line wsdl2java andjava2ws (CXF 2.1) or java2wsdl (CXF 2.0.x) options. Examples of such usage are on the tools’ respective pages.

Introducción a Apache CXF

Apache CXF is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS. These services can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA and work over a variety of transports such as HTTP, JMS or JBI.
CXF includes a broad feature set, but it is primarily focused on the following areas:
  • Web Services Standards Support: CXF supports a variety of web service standards including SOAP, the WSI Basic Profile, WSDL, WS-Addressing, WS-Policy, WS-ReliableMessaging, WS-Security, WS-SecurityPolicy, and WS-SecureConversation.
  • Frontends: CXF supports a variety of “frontend” programming models. CXF implements the JAX-WS APIs (TCK compliant). It also includes a “simple frontend” which allows creation of clients and endpoints without annotations. CXF supports both contract first development with WSDL and code first development starting from Java. For REST, CXF also supports a JAX-RS (TCK compliant) frontend.
  • Ease of use: CXF is designed to be intuitive and easy to use. There are simple APIs to quickly build code-first services, Maven plug-ins to make tooling integration easy, JAX-WS API support, Spring 2.x XML support to make configuration a snap, and much more.
  • Binary and Legacy Protocol Support: CXF has been designed to provide a pluggable architecture that supports not only XML but also non-XML type bindings, such as JSON and CORBA, in combination with any type of transport.