Social Media

Apache CXF – Quickstart

Is an open source web services development framework using JAX-WS and JAX-RS. Its goals are to be –

  • High Performance
  • Extensible
  • Intuitive & Easy to Use

It supports a number of protocols and transport including –

  • Protocols – SOAP, RESTful HTTP
  • Transport – HTTP, JMS, JBI(Java Business Integration)

Quickstart

The easiest way to create a CXF web service is through the servicemix archetypes(https://github.com/apache/servicemix-archetypes)

[sourcecode] mvn archetype:generate \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-cxf-code-first-osgi-bundle \
-DarchetypeVersion=2013.01 \
-DgroupId=com.glenware.cxf \
-DartifactId=myfirstcxf \
-Dversion=1.0-SNAPSHOT
[/sourcecode]

Compile and install –

[sourcecode] mvn clean install
[/sourcecode]

Then its a matter of installing the package in Fuse or ServiceMix –

[sourcecode] JBossFuse:karaf@root> install mvn:com.glenware.cxf/myfirstcxf/1.0-SNAPSHOT
JBossFuse:karaf@root> list
JBossFuse:karaf@root> start <number>
[/sourcecode]

Test the service is installed –

http://localhost:8181/cxf?wsdl

Or –

cd get-started/myfirstcxf
[sourcecode] mvn -Pclient
[/sourcecode] References

https://github.com/apache/servicemix-archetypes

https://github.com/apache/servicemix-archetypes/tree/trunk/servicemix-cxf-code-first-osgi-bundle

https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.0/html/Deploying_into_the_Container/files/DeployCxf-Running.html

About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: