You can use the maven plugin cxf-common-xsd.
I have used this in the camel soap component. See here:
http://svn.apache.org/repos/asf/camel/trunk/components/camel-soap/pom.xml
The sample below also shows how to customize the code generation using jaxb
plugins:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-common-xsd</artifactId>
<version>${cxf-version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/resources/soap.xsd</xsd>
</xsdOption>
</xsdOptions>
</configuration>
<goals>
<goal>xsdtojava</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-dv</artifactId>
<version>${cxf-version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-common-utilities</artifactId>
<version>${cxf-version}</version>
</dependency>
</dependencies>
</plugin>
Best regards
Christian
Christian Schneider
Informationsverarbeitung
Business Solutions
Handel und Dispatching
Tel : +49-(0)721-63-15482
EnBW Systeme Infrastruktur Support GmbH
Sitz der Gesellschaft: Karlsruhe
Handelsregister: Amtsgericht Mannheim HRB 108550
Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck
Geschäftsführer: Jochen Adenau, Hans-Günther Meier
-----Ursprüngliche Nachricht-----
Von: Glen Mazza [mailto:[email protected]]
Gesendet: Dienstag, 26. Oktober 2010 14:36
An: [email protected]
Betreff: Java-first approach: Using JAXB objects generated from XSDs
Hello, I had earlier converted my WSDL-first tutorial[1] into a Java-first[2]
one but I'm missing how to include a schema so I can use JAXB-generated
objects for the requests and responses, and how to generate the JAXB objects
from the schema during the JavaToWS build process so those objects can be
used.
For the first part, I believe I can just manually add @WebResult and
@WebParam annotations to each method in the SEI, identifying the desired
JAXB-generated classes to use. But how do I generate the JAXB objects from
the XSD? With WSDL-first, I just need to incorporate (or include) the
necessary XSD's in the WSDL and the WSDL2Java process will use JAXB to
create the request/response objects. But CXF's JavaToWS tool seems to lack
any command-line parameter to specify XSD's to generate the Java classes.
Am I supposed to use JAXB as a separate step for that--I can do that, it
just seems strange for this process not to be already incorporated in the
JavaToWS process.
Thanks,
Glen
[1] http://www.jroller.com/gmazza/entry/web_service_tutorial
[2] http://www.jroller.com/gmazza/entry/java_first_web_service
--
View this message in context:
http://cxf.547215.n5.nabble.com/Java-first-approach-Using-JAXB-objects-generated-from-XSDs-tp3236956p3236956.html
Sent from the cxf-user mailing list archive at Nabble.com.