You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Cameron Braid <ca...@braid.com.au> on 2009/04/21 13:08:22 UTC

I've created an example of implementing a jaxws client using CXF for deployment into smx4 (servicemix4)

I spent a few days wrestling with dependencies, incorrect samples,
mis-information to try an work out how to implement a bundle that uses CXF,
cxf-codegen-plugin's wsdl2java and the <jaxws:client> element in a spring
beans.xml file.

I have built two bundles which are hosted at
http://cams-code.googlecode.com/svn/osgi/

One bundle implements the soap client (helloworldclient) the other
(helloworldconsumer) uses a BundleActivator and a ServiceListener to trigger
a soap call and print out some info.

The helloworldclient uses a copy of the helloworld.wsdl file from the
examples-cxf-osgi bundle.

I don't have the time to type out a complete tutorial for this, so I will
just quickly explain the steps to checkout / build, and deploy the code

1) checkout the cxf example client and consumer

$ svn co
http://cams-code.googlecode.com/svn/osgi/cameronbraid.examples.cxf.helloworldclient/
$ svn co
http://cams-code.googlecode.com/svn/osgi/cameronbraid.examples.cxf.helloworldconsumer/

2) build the bundles

$ cd cameronbraid.examples.cxf.helloworldclient
$ mvn install
$ cd ..
$ cd cameronbraid.examples.cxf.helloworldconsumer
$ mvn install
$ cd ..

3) setup servicemix 4 - download smx4 from
http://servicemix.apache.org/SMX4/download.html and unzip

4) launch servicemix 4 and start the examples-cxf-osgi bundle

$ bin/servicemix
smx@root:/> features/install examples-cxf-osgi

5) test that the soap server has started

open your browser to http://localhost:8080/cxf/HelloWorld?wsdl

6) install and start the helloworldclient bundle

smx@root:/> osgi/install
mvn:cameronbraid.examples/cxf.helloworldclient/1.0-SNAPSHOT
Bundle ID: 160
smx@root:/> osgi/list | grep helloworldclient
[ 160] [Resolved   ] [       ] [   60]
cameronbraid.examples.cxf.helloworldclient (1.0.0.SNAPSHOT)
smx@root:/> osgi/start 160
smx@root:/> osgi/list | grep helloworldclient
[ 160] [Active     ] [Started] [   60]
cameronbraid.examples.cxf.helloworldclient (1.0.0.SNAPSHOT)

7) install and start the helloworldconsumer bundle

smx@root:/> osgi/install
mvn:cameronbraid.examples/cxf.helloworldconsumer/1.0-SNAPSHOT
Bundle ID: 161
smx@root:/> osgi/list | grep helloworldconsumer
[ 161] [Resolved   ] [       ] [   60]
cameronbraid.examples/cxf.helloworldconsumer (1.0.0.SNAPSHOT)
smx@root:/> osgi/start 161
serviceReference = [cameronbraid.examples.cxf.helloworldclient.HelloWorld]
service = org.apache.cxf.jaxws.JaxWsClientProxy@117a0daa
sayHiResponse =
cameronbraid.examples.cxf.helloworldclient.types.SayHiResponse@38476a1d
sayHiResponse.return = Hello cxf osgi

Cheers

Cameron