이 콘텐츠는 선택한 언어로 제공되지 않습니다.

5.2. Deploy the Apache Camel CXF Example


Overview

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

The following prerequisites are needed to build and run this example:
  • Either of the following Web servers are installed:
    • JBoss Web Server, or
    • JBoss Enterprise Application Platform
  • Java version 1.7 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

To obtain the code for the camel-example-cxf-tomcat example, you need to install the Apache Camel kit, apache-camel-2.15.1.redhat-620133.zip, provided in the extras/ directory of the JBoss Fuse installation.
Install the Apache Camel kit as follows:
  1. Find the Apache Camel kit at the following location:
    InstallDir/extras/apache-camel-2.15.1.redhat-620133.zip
    Copy to Clipboard Toggle word wrap
  2. Using a suitable archive utility on your platform, unzip the apache-camel-2.15.1.redhat-620133.zip file and extract it to a convenient location, CamelInstallDir.

The camel-example-cxf-tomcat example

The camel-example-cxf-tomcat example is located under the following sub-directory of the Apache Camel installation:
CamelInstallDir/examples/camel-example-cxf-tomcat/
Copy to Clipboard Toggle word wrap

Build and run the example

To build and run the camel-example-cxf-tomcat example, perform the following steps:
  1. Build the camel-example-cxf-tomcat example using Maven. 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 clean package
    Copy to Clipboard Toggle word wrap
    If this command executes successfully, you should be able to find the WAR file, camel-example-cxf-tomcat.war, under the camel-example-cxf-tomcat/target sub-directory.
  2. 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 Web Server (WS)—open a new command prompt and execute the startup.sh script from the tomcat8/bin/ directory (or the tomcat7/bin/ directory, as appropriate). For more details about how to configure and launch the WS, see the Installation Guide from the JBoss Web Server library.
    • JBoss Enterprise Application Platform (EAP)—for a standalone instance, open a new command prompt and execute the bin/standalone.sh script. For more details about how to configure and launch the EAP, see the Administration and Configuration Guide from the JBoss Enterprise Application Platform library.
  3. Deploy the camel-example-cxf-tomcat example to the running Web server. Manually copy the camel-example-cxf-tomcat.war WAR file from the camel-example-cxf-tomcat/target directory to the Web server's deployment directory, as follows:
    • JBoss Web Server (WS)—copy the camel-example-cxf-tomcat.war WAR file to the tomcat8/webapps directory (or tomcat7/webapps directory, as appropriate).
    • JBoss Enterprise Application Platform (EAP)—copy the camel-example-cxf-tomcat.war WAR file to the standalone/deployments directory.
  4. 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
    Copy to Clipboard Toggle word wrap
    Note
    This step might not work in the Safari browser.
  5. 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
    Copy to Clipboard Toggle word wrap
    If the client runs successfully, you should see some output like the following in your command window:
    ...
    [INFO] --- exec-maven-plugin:1.1.1:java (default-cli) @ camel-example-cxf-tomcat ---
    2013-07-24 13:59:16,829 [teClient.main()] INFO  ReflectionServiceFactoryBean
    - Creating Service {http://incident.cxf.example.camel.apache.org/}IncidentService
    from class org.apache.camel.example.cxf.incident.IncidentService
    OK;123
    IN PROGRESS
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7.445s
    [INFO] Finished at: Wed Jul 24 13:59:17 CEST 2013
    [INFO] Final Memory: 10M/81M
    [INFO] ------------------------------------------------------------------------
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat