Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You will need to compile the example first:

Code Block
languagetext

  mvn install

Remarks:

  • During the compilation phase, a unit test will be performed which simulates the
    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

...

1) launch the server

Code Block
languagetext

  karaf.bat
  

Note for Karaf 2.2.x:
a) edit the etc/jre.properties file to add the following packages to be exported

Code Block
languagetext

  jre-1.6=, \
  com.sun.org.apache.xerces.internal.dom, \
  com.sun.org.apache.xerces.internal.jaxp, \
  

...

2) Add features required

Code Block
languagetext

  features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.9.0/xml/features
  features:install war
  features:install cxf
  features:install camel-spring
  features:install camel-jaxb
  features:install camel-cxf
  

...

3) Deploy the example bundle

Code Block
languagetext

  osgi:install -s mvn:org.apache.camel/camel-example-cxf-osgi/2.9.0
  

4) Verify that your service is available using the following url in the browser.
We assume assuming the OOTB Karaf defaults 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. The immediate extension after the hostname and port ("cxf" in
the below URL) is configured via the org.apache.cxf.osgi.cfg file (Please see
http://team.ops4j.org/wiki//display/paxweb/Pax+Web for more information on PAX Web).

Code Block
languagetext

  http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl
  

5) Start SOAPUI or use crul to send the request
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 a SOAP
message generated by the unit test, for example:

--> and the message formatted that you copy in SOAPUI and send the message

Code Block
xml
xml
   
   <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>
  

 

If you use curl, you need to save the upper message in a file (data.xml) first and use the blow command to send the message. 

Code Block
languagetext
curl -X POST -T data.xml -H "Content-Type: text/xml" http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident

 

The response message looks like this

Code Block
languagexml
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
   <ns2:outputReportIncident xmlns:ns2="http://reportincident.example.camel.apache.org">
     <code>Accepted</code>
   </ns2:outputReportIncident>
  </soap:Body>
</soap:Envelope>

 

 

6) Check the file system
Check the folder "target/inbox/" in the Karaf base directory to see that a message has arrived.

...