Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.5.2. Deploy the Apache Camel CXF Example
Overview Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
This tutorial takes a standard Camel CXF example (the
camel-example-cxf-tomcat example) and shows you how to deploy it into a Web server, by packaging the application as a WAR. In this example, the Web service is implemented by binding the service to a Camel route using the Camel CXF component.
Prerequisites Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The following prerequisites are needed to build and run this example:
- Either of the following Web servers are installed:
- JBoss Enterprise Web Server, or
- JBoss Enterprise Application Platform
- Java version 1.6 or later is installed.
- Apache Maven 3.0.0 or later is installed.
- Maven is configured to access the JBoss Fuse repositories, as described in Section 2.1, “Preparing to use Maven”.
- You have access to the Internet, so that Maven can download dependencies from remote repositories.
Install Apache Camel Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To obtain the code for the
camel-example-cxf-tomcat example, you need to install the Apache Camel kit, apache-camel-2.12.0.redhat-610379.zip, provided in the extras/ directory of the JBoss Fuse installation.
Install the Apache Camel kit as follows:
- Find the Apache Camel kit at the following location:
InstallDir/extras/apache-camel-2.12.0.redhat-610379.zip
InstallDir/extras/apache-camel-2.12.0.redhat-610379.zipCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Using a suitable archive utility on your platform, unzip the
apache-camel-2.12.0.redhat-610379.zipfile and extract it to a convenient location,CamelInstallDir.
The camel-example-cxf-tomcat example Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The
camel-example-cxf-tomcat example is located under the following sub-directory of the Apache Camel installation:
CamelInstallDir/examples/camel-example-cxf-tomcat/
CamelInstallDir/examples/camel-example-cxf-tomcat/
Build and run the example Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
To build and run the
camel-example-cxf-tomcat example, perform the following steps:
- Build the
camel-example-cxf-tomcatexample using Maven. Change directory to theCamelInstallDir/examples/camel-example-cxf-tomcat/directory, open a command prompt, and enter the following command at the command line:mvn clean package
mvn clean packageCopy to Clipboard Copied! Toggle word wrap Toggle overflow If this command executes successfully, you should be able to find the WAR file,camel-example-cxf-tomcat.war, under thecamel-example-cxf-tomcat/targetsub-directory. - Make sure that the Web server is already running (a simple way to test this is to enter the URL,
http://localhost:8080, into your browser). If you need to start the Web server, you can typically do this from the command line. The command to start the Web server depends on the particular product you are using, as follows:- JBoss Enterprise Web Server (EWS)—open a new command prompt and execute the
startup.shscript from thetomcat7/bin/directory (or thetomcat6/bin/directory, as appropriate). For more details about how to configure and launch the EWS, see the Installation Guide from the JBoss Enterprise Web Server library. - JBoss Enterprise Application Platform (EAP)—for a standalone instance, open a new command prompt and execute the
bin/standalone.shscript. For more details about how to configure and launch the EAP, see the Administration and Configuration Guide from the JBoss Enterprise Application Platform library.
- Deploy the
camel-example-cxf-tomcatexample to the running Web server. Manually copy thecamel-example-cxf-tomcat.warWAR file from thecamel-example-cxf-tomcat/targetdirectory to the Web server's deployment directory, as follows:- JBoss Enterprise Web Server (EWS)—copy the
camel-example-cxf-tomcat.warWAR file to thetomcat7/webappsdirectory (ortomcat6/webappsdirectory, as appropriate). - JBoss Enterprise Application Platform (EAP)—copy the
camel-example-cxf-tomcat.warWAR file to thestandalone/deploymentsdirectory.
- Use a Web browser to query the WSDL contract from the newly deployed Web service. Navigate to the following URL in your browser:
http://localhost:8080/camel-example-cxf-tomcat/webservices/incident?wsdl
http://localhost:8080/camel-example-cxf-tomcat/webservices/incident?wsdlCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis step might not work in the Safari browser. - Run the test client against the deployed Web service. Change directory to the
CamelInstallDir/examples/camel-example-cxf-tomcat/directory, open a command prompt, and enter the following command at the command line:mvn exec:java
mvn exec:javaCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the client runs successfully, you should see some output like the following in your command window:Copy to Clipboard Copied! Toggle word wrap Toggle overflow