Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{scrollbar}

Anchor
top
top

CXF examples

This example leverages CXF and Spring-DM to create a web service and expose it through the OSGi HTTP Service.

Installing the CXF examples on ServiceMix Kernel

...

Code Block
titleMETA-INF/spring/beans.xml
langxml
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:jaxws="http://cxf.apache.org/jaxws"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

    <jaxws:endpoint id="helloWorld"
                    implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
                    address="/HelloWorld"/>

</beans>

Note that we use the OSGi transport so that this web service will be exposed through the standard OSGi HTTP service.

Also, you need to make sure the MANIFEST contains the needed OSGi headers, in our case:

Code Block

Import-Package: META-INF.cxf,META-INF.cxf.osgi,javax.jws
Require-Bundle: org.apache.servicemix.bundles.woodstox-3.2.3

Exposing the service to ServiceMix internal bus

We can go a step beyond and try to expose the same service to ServiceMix internal bus (NMR) so that we can connect it to multiple components (BPEL engine, Rules engine, XSLT engine, etc...). We will see that in the next example.

Resources

Source code for this example is available at the following location:

Code Block

http://svn.apache.org/repos/asf/servicemix/smx4/features/trunk/examples/cxf-osgi/

#top

Wiki Markup
{scrollbar}