You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Christian Müller (JIRA)" <ji...@apache.org> on 2011/04/08 23:09:05 UTC

[jira] [Updated] (CAMEL-3756) Add an example which use CXF bean binding and the OSGI HTTP Service (e.g. PAX Web with jetty)

     [ https://issues.apache.org/jira/browse/CAMEL-3756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Müller updated CAMEL-3756:
------------------------------------

    Attachment: CAMEL-3756.patch
                camel-example-cxf-osgi-2.2.0.jar

{noformat}
CXF OSGI Example
=======================

A simple example which receives web service calls (via a CXF consumer, using bean binding)
and write these requests into the file system. It's not a very useful use case, but the goal
of this example is to show you how you can use the CXF consumer component in an OSGI
environment with the OSGI HTTP service. If your target container is Apache Karaf or Apache
ServiceMix, you can use PAX Web to setup and start an OSGI HTTP service. All your Camel
bundles using a Camel CXF consumer can use this HTTP service and do not have to start it's
own Jetty instance. Another possibility you get is, that all your provided services can share
the same port.


You will need to compile this example first:
  mvn install

Remarks:
- During the compilation phase, a unit test will be performed, this unit test simulates the
  communication between a client calling the web service exposed by our camel/cxf route.
- In Eclipse, I have used the following option when starting the junit test case. This option tells
  CXF that it must use log4j : -Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger

To run the example on Apache ServiceMix 4.x or Apache Karaf 1.x / 2.x

  1) launch the server
  karaf.bat
  
  For Karaf 2.0 : edit the file jre.properties to add the following packages to be exported
  jre-1.6=, \
 com.sun.org.apache.xerces.internal.dom, \
 com.sun.org.apache.xerces.internal.jaxp, \
 
  2) Add features required
  features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8-SNAPSHOT/xml/features
  features:install http
  features:install cxf
  features:install camel-cxf
  
  3) Deploy our example
  osgi:install -s mvn:org.apache.camel/camel-example-cxf-osgi
  
  4) Verify that your service is available using in the browser the following url. We assume you
  use the default PAX Web configuration which use the port 8181 for http. If you would like to use
  another port or https, change the configuration in ${KARAF_HOME}/etc/org.ops4j.pax.web.cfg. Please
  see http://wiki.ops4j.org/display/paxweb/Pax+Web for more information.
  
  http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl
  
  5) Start SOAPUI (2.x)
  Create a new project called camel-example-cxf-osgi
  Point to the following url : http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl
  Open the request 1 (under camel-example-cxf-osgi --> ReportIncidentBinding --> ReportIncident) and copy/paste the SOAP
  message generated by the unit test
  
  ex :
  --> and the message formatted that you copy in SOAPUI
  
		<?xml version="1.0" encoding="UTF-8"?>
		<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
			<soap:Header />
			<soap:Body>
				<ns2:inputReportIncident xmlns:ns2="http://reportincident.example.camel.apache.org">
					<incidentId>111</incidentId>
					<incidentDate>2011-03-05</incidentDate>
					<givenName>Christian</givenName>
					<familyName>Mueller</familyName>
					<summary>Bla</summary>
					<details>Bla bla</details>
					<email>cmueller@apache.org</email>
					<phone>0049 69 1234567</phone>
				</ns2:inputReportIncident>
			</soap:Body>
		</soap:Envelope>
  
 6) Check the file system
 Check the folder "target/inbox/" in your file system that a message has been arrived.


If you hit any problems please let us know on the Camel Forums
  http://camel.apache.org/discussion-forums.html

Please help us make Apache Camel better - we appreciate any feedback you may
have.  Enjoy!

------------------------
The Camel riders!

{noformat}

> Add an example which use CXF bean binding and the OSGI HTTP Service (e.g. PAX Web with jetty)
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3756
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3756
>             Project: Camel
>          Issue Type: Improvement
>          Components: examples
>    Affects Versions: 2.6.0
>            Reporter: Christian Müller
>            Assignee: Christian Müller
>             Fix For: 2.8.0, 3.0.0
>
>         Attachments: CAMEL-3756.patch, camel-example-cxf-osgi-2.2.0.jar
>
>
> Please see [Nabble|http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p3379974.html] for details.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira