Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Swordfish Documentation: CXF Integration

Swordfish is built on top of the Servicemix 4 NMR and it leverages its CXF integration capabilities.


CXF Endpoint Deployment

http://servicemix.apache.org/SMX4/cxf-examples.html

To deploy the CXF endpoint into the NMR, the bundle that contains the following spring osgi application context should be started:

  <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:osgi="http://www.springframework.org/schema/osgi"
      xmlns:camel-osgi="http://activemq.apache.org/camel/schema/osgi"
      xmlns:http="http://servicemix.apache.org/http/1.0"
      xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
      http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.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/transport/nmr/cxf-transport-nmr.xml" />
   <jaxws:endpoint id="bookingService"
                       implementor="org.eclipse.swordfish.samples.cxf.BookingServiceImpl"
                       address="nmr:BookingService">
                       <jaxws:inInterceptors>
                       <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
                       </jaxws:inInterceptors>
   </jaxws:endpoint>
 </beans>

The entry address="nmr:BookingService" specifies that endpoint should be pluged into the nmr and it should be deployed along with the property SERVICE_NAME=BookingService.

The Swordfish team has created the sample that deploys the CXF endpoint org.eclipse.swordfish.samples.cxfendpoint

Http Consumer Endpoint Deployment

The CXF endpoint may be exposed via the ServiceMix http binding component

1. Make sure that the Swordfish distribution contains the osgi packaged http binding component(servicemix-http bundle symbolic name)
2. Add the bundle that deploys the http consumer endpoint without the jbi packaging http://servicemix.apache.org/SMX4NMR/3-deploying-jbi-components-without-the-jbi-packaging.html The bundle should contain the Spring OSGI application context with such entry:

   <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:http="http://servicemix.apache.org/http/1.0"       
      xmlns:osgi="http://www.springframework.org/schema/osgi"
      xmlns:swordfishCxf="http://cxf.samples.swordfish.eclipse.org/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/osgi
        http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://servicemix.apache.org/http/1.0
        http://servicemix.apache.org/http/1.0/servicemix-http.xsd">  
        <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />  
        <http:endpoint                  
                endpoint="httpConsumerEndpoint"                 
                service="httpConsumerEndpoint"
                targetService="swordfishCxf:BookingServiceImpl"
                soap="true"
                role="consumer"                  
                locationURI="http://0.0.0.0:8192/cxfsample/"
                defaultMep="http://www.w3.org/2004/08/wsdl/in-out" />
    </beans>

You can explore the corresponding Swordfish sample here



return to Swordfish Documentation Home
go to Swordfish Wiki Home

Copyright © Eclipse Foundation, Inc. All Rights Reserved.