You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Hoffer <da...@issinc.com> on 2008/08/24 14:53:05 UTC

CXF & Maven

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


Re: CXF & Maven

Posted by Benson Margulies <bi...@gmail.com>.
Php, eh? Well, following the example of the Javascript code, someone
could add a PHP code generator. I'd be happy to mentor a volunteer.

On Sun, Aug 24, 2008 at 8:53 AM, David Hoffer <da...@issinc.com> wrote:
> 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
>
>

RE: CXF & Maven

Posted by David Hoffer <da...@issinc.com>.
Right you are; my mistake.  

I had been looking for version 2.1.2; then did a quick Google search for the
plug-in and came up empty.  I should have tried other versions.

Thanks much!
-Dave

-----Original Message-----
From: Christian Schneider [mailto:chris@die-schneider.net] 
Sent: Monday, August 25, 2008 5:03 AM
To: users@cxf.apache.org
Subject: Re: CXF & Maven

I simply fetched it from the repo1.maven.org. This should be the 
standard location fo maven.

http://repo1.maven.org/maven2/org/apache/cxf/cxf-codegen-plugin/2.1.1/cxf-co
degen-plugin-2.1.1.pom

I have attached my complete pom. I just tested it with an empty maven repo.

Best regards

Christian

David Hoffer schrieb:
> Generating the WSDL worked great!  Regarding part 2, what repo is
> cxf-codegen-plugin hosted on?  Currently my proxy doesn't find this
plugin.
>
> Thanks
> -Dave
>
>   

-- 

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


----





Re: CXF & Maven

Posted by Christian Schneider <ch...@die-schneider.net>.
I simply fetched it from the repo1.maven.org. This should be the 
standard location fo maven.

http://repo1.maven.org/maven2/org/apache/cxf/cxf-codegen-plugin/2.1.1/cxf-codegen-plugin-2.1.1.pom

I have attached my complete pom. I just tested it with an empty maven repo.

Best regards

Christian

David Hoffer schrieb:
> Generating the WSDL worked great!  Regarding part 2, what repo is
> cxf-codegen-plugin hosted on?  Currently my proxy doesn't find this plugin.
>
> Thanks
> -Dave
>
>   

-- 

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


----




RE: CXF & Maven

Posted by David Hoffer <da...@issinc.com>.
Generating the WSDL worked great!  Regarding part 2, what repo is
cxf-codegen-plugin hosted on?  Currently my proxy doesn't find this plugin.

Thanks
-Dave

-----Original Message-----
From: Christian Schneider [mailto:chris@die-schneider.net] 
Sent: Sunday, August 24, 2008 11:40 AM
To: users@cxf.apache.org
Subject: Re: CXF & Maven

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-ws
dl-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:schema[@targetNamespace='http://custome
rservice.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





Re: CXF & Maven

Posted by Christian Schneider <ch...@die-schneider.net>.
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:schema[@targetNamespace='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