Hi David,

I have set up a howto for the first part. Generating the WSDL:

http://cwiki.apache.org/CXF20DOC/defining-contract-first-webservices-with-wsdl-generation-from-java.html

Currently I am working on a complete example for part 2. I have attached the pom snippet for generating the code.

Generating code for other languages could be possible by using the maven exec plugin http://mojo.codehaus.org/exec-maven-plugin/usage.html. You can call native generators for the other languages.

Best regards

Christian

---

<plugin>
               <groupId>org.apache.cxf</groupId>
               <artifactId>cxf-codegen-plugin</artifactId>
               <version>${cxf.version}</version>
               <executions>
                   <execution>
                       <id>generate-sources</id>
                       <phase>generate-sources</phase>
                       <configuration>
<sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
                           <wsdlOptions>
                               <wsdlOption>
<wsdl>${basedir}/src/main/wsdl/CustomerService.wsdl</wsdl>
                                   <extraargs>
                                       <extraarg>-b</extraarg>
<extraarg>${basedir}/src/main/wsdl/binding.xml</extraarg>
                                   </extraargs>

                               </wsdlOption>
                           </wsdlOptions>
                       </configuration>
                       <goals>
                           <goal>wsdl2java</goal>
                       </goals>
                   </execution>
               </executions>
           </plugin>

The example uses a special binding.xml so xsd:datetime are generated as Date not as XMLGregorianDate:

<jaxws:bindings wsdlLocation="CustomerService.wsdl"
         xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
         xmlns:xs="http://www.w3.org/2001/XMLSchema";
         xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:[EMAIL PROTECTED]'http://customerservice.example.com/']"> <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb"; xmlns:xs="http://www.w3.org/2001/XMLSchema";>
       <jxb:javaType name="java.util.Date" xmlType="xs:dateTime"
parseMethod="org.apache.cxf.tools.common.DataTypeAdapter.parseDateTime" printMethod="org.apache.cxf.tools.common.DataTypeAdapter.printDateTime"/>
     </jxb:globalBindings>
 </jaxws:bindings>
</jaxws:bindings>


David Hoffer schrieb:
As part of my build process using CXF to create/publish a web-service, I
would like to do the following things in my maven build:

1. Generate the wsdl for documentation/publishing.
2. Generate the client Java code that clients could use to connect to my
web-service.
3. Optionally generate the client code for other languages such as PHP, is
this even possible.  (I want to make it as easy as possible for clients to
connect; one of the languages used is likely to be PHP.)

How can I do these things in my pom during install/release?

-Dave




--

Christian Schneider
---
http://www.liquid-reality.de

Reply via email to