Red Hat JBoss Fuse ESB + Apache Camel CXF-RS WebService + OSGI Blueprint DSL + Example

In this blog, we will learn to implement a simple Apache Camel CXF Rest Webservice and deploy it on Red Hat JBoss Fuse.

In this example we are exposing an endpoint as REST Webservice, which will take input request as a string and will return output response string with welcome message.

First of all we need to create a new Fuse Integration Project in Red Hat JBoss Developer Studio.

Technology Stack

Java 8
jboss-fuse-6.3.0.redhat-187
Apache CXF (2.17.0.redhat-630187)
Apache Camel (2.17.0.redhat-630187)
OSGI Blueprint DSL
SoapUI-Pro-5.1.1

Project Structure

High level project structure would be looked like as below

Maven File: pom.xml

We need to add camel-cxf maven dependency for exposing REST interface as below.

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.the.basic.tech.info</groupId>
	<artifactId>apache-camel-cxfrs-webservice</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>bundle</packaging>
	<name>apache-camel-cxfrs-webservice</name>
	<description>Apache Camel Cxfrs Blueprint Example</description>
	<properties>
		<camel.version>2.17.0.redhat-630187</camel.version>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<version.maven-bundle-plugin>3.2.0</version.maven-bundle-plugin>
		<jboss.fuse.bom.version>6.3.0.redhat-187</jboss.fuse.bom.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.jboss.fuse.bom</groupId>
				<artifactId>jboss-fuse-parent</artifactId>
				<version>${jboss.fuse.bom.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-blueprint</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-cxf</artifactId>
		</dependency>		
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-test-blueprint</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>org.apache.felix.fileinstall</artifactId>
					<groupId>org.apache.felix</groupId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>
	<repositories>
		<repository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<id>fuse-public-repository</id>
			<name>FuseSource Community Release Repository</name>
			<url>https://repo.fusesource.com/nexus/content/groups/public</url>
		</repository>
		<repository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<id>red-hat-ga-repository</id>
			<name>Red Hat GA Repository</name>
			<url>https://maven.repository.redhat.com/ga</url>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<id>fuse-public-repository</id>
			<name>FuseSource Community Release Repository</name>
			<url>https://repo.fusesource.com/nexus/content/groups/public</url>
		</pluginRepository>
		<pluginRepository>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<id>red-hat-ga-repository</id>
			<name>Red Hat GA Repository</name>
			<url>https://maven.repository.redhat.com/ga</url>
		</pluginRepository>
	</pluginRepositories>
	<build>
		<defaultGoal>install</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>${version.maven-bundle-plugin}</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>apache-camel-cxfrs-webservice</Bundle-SymbolicName>
						<Bundle-Name>Camel Blueprint Example [apache-camel-cxfrs-webservice]</Bundle-Name>
					</instructions>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.5.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.0.1</version>
				<configuration>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.camel</groupId>
				<artifactId>camel-maven-plugin</artifactId>
				<version>${camel.version}</version>
				<configuration>
					<useBlueprint>true</useBlueprint>
				</configuration>
			</plugin>			
		</plugins>
	</build>
</project>

OSGI Blueprint : camel-context.xml

In OSGI Blueprint camel-context.xml file camel route needs to be added.

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf" xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0  https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd  http://camel.apache.org/schema/blueprint/cxf  http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd  http://cxf.apache.org/blueprint/jaxrs  http://cxf.apache.org/schemas/blueprint/jaxrs.xsd  http://camel.apache.org/schema/blueprint  http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

	<!-- cxfrsEndpoint exposed on 9090 custom port. We can make if configurable -->
	<cxf:rsServer id="cXFRsTest" address="http://localhost:9090/employeeservice" serviceClass="com.the.basic.tech.info.beans.EmployeeServiceResource">
	</cxf:rsServer>

	<!-- custom processor for cxfrs -->
	<bean id="customprocessor" class="com.the.basic.tech.info.beans.CamelProcessorRest" />

	<camelContext id="camel_id" xmlns="http://camel.apache.org/schema/blueprint">

		<!-- cxfrs route -->
		<route id="route_id">
			<from uri="cxfrs:bean:cXFRsTest" />
			<process ref="customprocessor" />
		</route>

	</camelContext>
</blueprint>

Camel Custom Processor : CamelProcessorRest.java

In this custom processor class we are implementing the Processor interface’s process() method as below.

package com.the.basic.tech.info.beans;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

public class CamelProcessorRest implements Processor {

	public void process(Exchange exchange) throws Exception {

		// Get input from body
		String msg = exchange.getIn().getBody(String.class);
		// Set output in body
		exchange.getOut().setBody("Welcome " + msg);
	}
}

Rest Controller : EmployeeServiceResource.java

We need to expose GET REST operation in Rest Controller. Hence, client can hit this directly for getting Result.

package com.the.basic.tech.info.beans;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

@Path("/")
public class EmployeeServiceResource {

	public EmployeeServiceResource() {
	}

	@GET
	@Path("/employees/{name}/")
	public String getCustomer(@PathParam("name") String name) {
		return null;
	}

}

OSGI Bundle : Build, Install, Deploy

To build this project use below command.

D:\development\apache-camel-cxfrs-webservice>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building apache-camel-cxfrs-webservice 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ apache-camel-cxfrs-webservice ---
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ apache-camel-cxfrs-webservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ apache-camel-cxfrs-webservice ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to D:\development\apache-camel-cxfrs-webservice\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ apache-camel-cxfrs-webservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\development\apache-camel-cxfrs-webservice\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ apache-camel-cxfrs-webservice ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ apache-camel-cxfrs-webservice ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:bundle (default-bundle) @ apache-camel-cxfrs-webservice ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ apache-camel-cxfrs-webservice ---
[INFO] Installing D:\development\apache-camel-cxfrs-webservice\target\apache-camel-cxfrs-webservice-1.0.0-SNAPSHOT.jar to C:\Users\172025\.m2\repository\com\the\basic\tech\info\apache-camel-cxfrs-webservice\1.0.0-SNAPSHOT\apache-camel-cxfrs-webservice-1.0.0-SNAPSHOT.jar
[INFO] Installing D:\development\apache-camel-cxfrs-webservice\pom.xml to C:\Users\172025\.m2\repository\com\the\basic\tech\info\apache-camel-cxfrs-webservice\1.0.0-SNAPSHOT\apache-camel-cxfrs-webservice-1.0.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:install (default-install) @ apache-camel-cxfrs-webservice ---
[INFO] Installing com/the/basic/tech/info/apache-camel-cxfrs-webservice/1.0.0-SNAPSHOT/apache-camel-cxfrs-webservice-1.0.0-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.873 s
[INFO] Finished at: 2021-07-12T14:00:25+05:30
[INFO] Final Memory: 28M/251M
[INFO] ------------------------------------------------------------------------

D:\development\apache-camel-cxfrs-webservice>

How to deploy the project into OSGi container

For deploying the fuse bundle the following command from its shell needs to be executed.

Note: We can see our bundle under the list of services and tail the logs for debugging. Use the following OSGI commands.

JBossFuse:karaf@root> osgi:install -s mvn:com.the.basic.tech.info/apache-camel-cxfrs-webservice/1.0.0-SNAPSHOT
Bundle ID: 296
JBossFuse:karaf@root> list

START LEVEL 100 , List Threshold: 50
   ID   State         Blueprint      Spring    Level  Name
[  14] [Active     ] [Created     ] [       ] [   50] JBoss Fuse :: ESB :: Commands (6.3.0.redhat-187)
[  15] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: Admin :: Management (2.4.0.redhat-630187)
[ 142] [Active     ] [            ] [       ] [   80] Scala Standard Library (2.10.4.v20140209-180020-VFINAL-b66a39653b)
[ 143] [Active     ] [            ] [       ] [   80] Scala Reflect (2.10.4.v20140209-180020-VFINAL-b66a39653b)
[ 144] [Active     ] [            ] [       ] [   80] Guava: Google Core Libraries for Java (15.0.0)
[ 145] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: javax.inject (1.0.0.2)
[ 146] [Active     ] [            ] [       ] [   80] Jackson-module-JAXB-annotations (2.6.3)
[ 147] [Active     ] [            ] [       ] [   80] Jackson-module-paranamer (2.6.3)
[ 148] [Active     ] [            ] [       ] [   80] com.fasterxml.jackson.module.jackson.module.scala (2.6.3)
[ 149] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: swagger-annotations (1.3.12.1)
[ 150] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: swagger-core_2.10 (1.3.12.1)
[ 151] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: swagger-jaxrs_2.10 (1.3.12.1)
[ 152] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: paranamer (2.8.0.1)
[ 153] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: json4s (3.2.8.1)
[ 155] [Active     ] [            ] [       ] [   80] Fabric8 :: Maven Bundle (1.2.0.redhat-630187)
[ 156] [Active     ] [Created     ] [       ] [   50] Apache Karaf :: Shell :: SSH (2.4.0.redhat-630187)
[ 158] [Active     ] [            ] [       ] [   50] Apache Mina SSHD :: Core (0.14.0)
[ 159] [Active     ] [            ] [       ] [   50] Apache MINA Core (2.0.13)
[ 162] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: Deployer :: Spring (2.4.0.redhat-630187)
[ 163] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: Deployer :: Wrap Non OSGi Jar (2.4.0.redhat-630187)
[ 164] [Active     ] [            ] [       ] [   80] mvel2 (2.2.7.Final-redhat-1)
[ 165] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Bundles :: jsch (0.1.53.1)
[ 166] [Active     ] [            ] [       ] [   80] Apache Commons Collections (3.2.2.redhat-2)
[ 167] [Active     ] [            ] [       ] [   80] Apache Commons BeanUtils (1.9.2.redhat-1)
[ 168] [Active     ] [            ] [       ] [   80] bndlib (2.4.1.201501161923)
[ 169] [Active     ] [            ] [       ] [   80] Fabric8 :: Common :: Util (1.2.0.redhat-630187)
[ 170] [Active     ] [            ] [       ] [   80] Fabric8 :: API (1.2.0.redhat-630187)
[ 171] [Active     ] [            ] [       ] [   80] Fabric8 :: Core (1.2.0.redhat-630187)
[ 172] [Active     ] [            ] [       ] [   80] Fabric8 :: Groups (1.2.0.redhat-630187)
[ 173] [Active     ] [            ] [       ] [   80] Fabric8 :: Git (1.2.0.redhat-630187)
[ 174] [Active     ] [            ] [       ] [   80] Fabric8 :: ConfigAdmin Bridge (1.2.0.redhat-630187)
[ 175] [Active     ] [            ] [       ] [   80] Fabric8 :: Provisioning Agent (1.2.0.redhat-630187)
[ 176] [Active     ] [            ] [       ] [   80] Fabric8 :: Extender Listener (1.2.0.redhat-630187)
[ 177] [Active     ] [            ] [       ] [   80] Fabric8 :: JAAS (1.2.0.redhat-630187)
[ 178] [Active     ] [            ] [       ] [   80] Fabric8 :: ZooKeeper Service (1.2.0.redhat-630187)
[ 179] [Active     ] [            ] [       ] [   80] Fabric8 :: Karaf Features Service (1.2.0.redhat-630187)
[ 180] [Active     ] [            ] [       ] [   80] Fabric8 :: Insight :: Logging (1.2.0.redhat-630187)
[ 181] [Active     ] [            ] [       ] [   80] Fabric8 :: Runtime :: Container :: Karaf :: Registration (1.2.0.redhat-630187)
[ 182] [Active     ] [Created     ] [       ] [   80] Fabric8 :: CXF Component (1.2.0.redhat-630187)
[ 183] [Active     ] [            ] [       ] [   80] Apache Karaf :: Shell :: SCR Commands (2.4.0.redhat-630187)
[ 185] [Active     ] [            ] [       ] [   80] Fabric8 :: Git :: Server (1.2.0.redhat-630187)
[ 186] [Active     ] [            ] [       ] [   80] Fabric8 :: Boot Commands (1.2.0.redhat-630187)
[ 187] [Active     ] [            ] [       ] [   80] Fabric8 :: Redirect (1.2.0.redhat-630187)
[ 188] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: Features :: Command (2.4.0.redhat-630187)
[ 189] [Active     ] [            ] [       ] [   80] Fabric8 :: Karaf Commands (1.2.0.redhat-630187)
[ 190] [Active     ] [            ] [       ] [   80] Fabric8 :: Project Deployer (1.2.0.redhat-630187)
[ 191] [Active     ] [            ] [       ] [   80] Commons IO (2.4.0.redhat-1)
[ 192] [Active     ] [            ] [       ] [   80] Fabric8 :: Maven Proxy (1.2.0.redhat-630187)
[ 193] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: Features :: Management (2.4.0.redhat-630187)
[ 194] [Active     ] [            ] [       ] [   80] Fabric8 :: Patch :: Core :: API (1.2.0.redhat-630187)
[ 195] [Active     ] [            ] [       ] [   80] Fabric8 :: Patch :: Core (1.2.0.redhat-630187)
[ 196] [Active     ] [            ] [       ] [   80] Fabric8 :: Patch :: Commands (1.2.0.redhat-630187)
[ 199] [Active     ] [            ] [       ] [   80] JMS API (2.0.1)
[ 212] [Active     ] [            ] [       ] [   50] geronimo-annotation_1.0_spec (1.1.1)
[ 213] [Active     ] [            ] [       ] [   50] geronimo-j2ee-management_1.1_spec (1.0.1)
[ 214] [Active     ] [            ] [       ] [   50] JAXB2 Basics - Runtime (0.6.4)
[ 215] [Active     ] [            ] [       ] [   50] Commons Pool (1.6.0.redhat-9)
[ 216] [Active     ] [            ] [       ] [   50] Commons Net (3.3.0.redhat-3)
[ 217] [Active     ] [            ] [       ] [   50] ZooKeeper Bundle (3.4.7)
[ 218] [Active     ] [            ] [       ] [   50] Apache XBean :: Spring (3.18.0)
[ 219] [Active     ] [Created     ] [       ] [   50] activemq-osgi (5.11.0.redhat-630187), Fragments: 230
[ 220] [Active     ] [Created     ] [       ] [   50] activemq-karaf (5.11.0.redhat-630187)
[ 221] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: velocity (1.7.0.6)
[ 222] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: jasypt-spring31 (1.9.3.redhat_3)
[ 223] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: xpp3 (1.1.4.c)
[ 224] [Active     ] [            ] [       ] [   50] Joda-Time (2.9.2)
[ 225] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: xstream (1.4.8.1)
[ 226] [Active     ] [            ] [       ] [   50] geronimo-j2ee-connector_1.5_spec (2.0.0)
[ 227] [Active     ] [            ] [       ] [   50] activeio-core (3.1.4)
[ 228] [Active     ] [            ] [       ] [   50] Scala Standard Library (2.11.7.v20150622-112736-1fbce4612c)
[ 229] [Active     ] [            ] [       ] [   80] Apache XBean :: Classloader (3.18.0)
[ 230] [Resolved   ] [            ] [       ] [   80] Fabric8 :: MQ :: Discovery (1.2.0.redhat-630187), Hosts: 219
[ 231] [Active     ] [            ] [       ] [   80] Fabric8 :: MQ :: Fabric (1.2.0.redhat-630187)
[ 232] [Active     ] [            ] [       ] [   50] camel-core (2.17.0.redhat-630187)
[ 233] [Active     ] [            ] [       ] [   50] camel-catalog (2.17.0.redhat-630187)
[ 234] [Active     ] [Created     ] [       ] [   50] camel-blueprint (2.17.0.redhat-630187)
[ 235] [Active     ] [            ] [       ] [   50] camel-commands-core (2.17.0.redhat-630187)
[ 236] [Active     ] [Created     ] [       ] [   50] camel-karaf-commands (2.17.0.redhat-630187)
[ 238] [Active     ] [            ] [       ] [   50] camel-spring (2.17.0.redhat-630187)
[ 240] [Active     ] [Created     ] [       ] [   50] camel-cxf-transport (2.17.0.redhat-630187)
[ 241] [Active     ] [Created     ] [       ] [   50] camel-cxf (2.17.0.redhat-630187)
[ 242] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: JMS :: Core (2.4.0.redhat-630187)
[ 244] [Active     ] [            ] [       ] [   50] camel-jms (2.17.0.redhat-630187)
[ 245] [Active     ] [Created     ] [       ] [   80] Apache Karaf :: JMS :: Command (2.4.0.redhat-630187)
[ 246] [Active     ] [            ] [       ] [   80] activemq-camel (5.11.0.redhat-630187)
[ 247] [Active     ] [            ] [       ] [   80] Fabric8 :: MQ :: Fabric Camel Component (1.2.0.redhat-630187)
[ 248] [Active     ] [            ] [       ] [   50] Apache Commons CSV (1.1.0)
[ 249] [Active     ] [            ] [       ] [   50] camel-csv (2.17.0.redhat-630187)
[ 250] [Active     ] [            ] [       ] [   50] camel-ftp (2.17.0.redhat-630187)
[ 251] [Active     ] [            ] [       ] [   50] camel-bindy (2.17.0.redhat-630187)
[ 252] [Active     ] [            ] [       ] [   50] camel-jdbc (2.17.0.redhat-630187)
[ 253] [Active     ] [            ] [       ] [   50] Apache Commons Exec (1.3.0)
[ 254] [Active     ] [            ] [       ] [   50] camel-exec (2.17.0.redhat-630187)
[ 255] [Active     ] [            ] [       ] [   50] camel-jasypt (2.17.0.redhat-630187)
[ 256] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: Saxon-HE (9.5.1.5_1)
[ 257] [Active     ] [            ] [       ] [   50] camel-saxon (2.17.0.redhat-630187)
[ 258] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: snmp4j (2.3.4.1)
[ 259] [Active     ] [            ] [       ] [   50] camel-snmp (2.17.0.redhat-630187)
[ 260] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: ognl (3.1.2.1)
[ 261] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: javassist (3.12.1.GA_3)
[ 262] [Active     ] [            ] [       ] [   50] camel-ognl (2.17.0.redhat-630187)
[ 263] [Active     ] [            ] [       ] [   50] camel-routebox (2.17.0.redhat-630187)
[ 264] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: antlr (3.5.2.1)
[ 265] [Active     ] [            ] [       ] [   50] Apache ServiceMix :: Bundles :: js (1.0.0.7R2_3)
[ 266] [Active     ] [            ] [       ] [   50] camel-script (2.17.0.redhat-630187)
[ 267] [Active     ] [            ] [       ] [   50] camel-spring-javaconfig (2.17.0.redhat-630187)
[ 268] [Active     ] [            ] [       ] [   50] camel-jaxb (2.17.0.redhat-630187)
[ 269] [Active     ] [            ] [       ] [   50] camel-jmx (2.17.0.redhat-630187)
[ 270] [Active     ] [            ] [       ] [   50] camel-mail (2.17.0.redhat-630187)
[ 271] [Active     ] [            ] [       ] [   50] camel-paxlogging (2.17.0.redhat-630187)
[ 272] [Active     ] [            ] [       ] [   50] camel-rmi (2.17.0.redhat-630187)
[ 280] [Active     ] [Created     ] [       ] [   80] hawtio :: hawtio-json-schema-mbean (1.4.0.redhat-630187)
[ 281] [Active     ] [            ] [       ] [   80] hawtio :: hawtio-osgi-jmx (1.4.0.redhat-630187)
[ 282] [Active     ] [            ] [       ] [   80] hawtio :: hawtio-web (1.4.0.redhat-630187)
[ 283] [Active     ] [            ] [       ] [   80] JLine (2.12.1.redhat-002)
[ 284] [Active     ] [Created     ] [       ] [   80] hawtio :: Karaf terminal plugin (1.4.0.redhat-630187)
[ 285] [Active     ] [            ] [       ] [   80] JBoss Fuse :: Support :: Core (1.2.0.redhat-630187)
[ 286] [Active     ] [            ] [       ] [   80] JBoss Fuse :: Support :: Commands (1.2.0.redhat-630187)
[ 287] [Active     ] [            ] [       ] [   80] JBoss Fuse :: Support :: Karaf (1.2.0.redhat-630187)
[ 288] [Active     ] [            ] [       ] [   80] Tooling for support (1.2.0.redhat-630187)
[ 289] [Active     ] [            ] [       ] [   80] JBoss Fuse :: Support :: Fabric8 (1.2.0.redhat-630187)
[ 290] [Active     ] [            ] [       ] [   80] hawtio :: Red Hat Fuse Branding (1.4.0.redhat-630187)
[ 291] [Active     ] [            ] [       ] [   80] Apache ServiceMix :: Specs :: JSR-311 API 1.1.1 (2.7.0)
[ 292] [Active     ] [            ] [       ] [   80] D__Software_jboss-fuse (6.3.0)
[ 296] [Active     ] [Created     ] [       ] [   80] Camel Blueprint Example [apache-camel-cxfrs-webservice] (1.0.0.SNAPSHOT)
JBossFuse:karaf@root> log:tail
2021-07-12 14:02:34,644 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Starting JMX OSGi agent
2021-07-12 14:02:34,682 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Registering MBean with ObjectName [osgi.compendium:service=cm,version=1.3,framework=org.apache.felix.framework,uuid=b5e0dd65-495b-4ada-b700-b2b25be7045f] for service with service.id [14]
2021-07-12 14:02:34,687 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.BundleStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@7440e464 with name osgi.core:type=bundleState,version=1.7,framework=org.apache.felix.framework,uuid=b5e0dd65-495b-4ada-b700-b2b25be7045f
2021-07-12 14:02:34,690 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.wiring.BundleWiringStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@7440e464 with name osgi.core:type=wiringState,version=1.1,framework=org.apache.felix.framework,uuid=b5e0dd65-495b-4ada-b700-b2b25be7045f

Access Cxfrs End Points

Hit on the browser URL: http://localhost:8181/cxf

Under RESTFul services we can see emloyeeservice WADL file. It will be displayed as below once you will click on the link.

Note: You may download and save it as employeeservice.wadl in local. Which we will import in SoapUI for request and response testing.

SoapUI : Test Apache CXF Rest Webservice Create Rest Project in SoapUI from WADL File : http://localhost:9090/employeeservice?_wadl

Red Hat JBoss Fuse Logs : ~jboss-fuse-6.3.0.redhat-187/data/log/fuse.log

2021-07-12 14:05:04,607 | INFO  | l Console Thread | ManagedManagementStrategy        | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | JMX is enabled
2021-07-12 14:05:04,728 | INFO  | l Console Thread | DefaultRuntimeEndpointRegistry   | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000)
2021-07-12 14:05:04,895 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
2021-07-12 14:05:04,896 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
2021-07-12 14:05:04,956 | INFO  | l Console Thread | JettyHTTPServerEngineFactory     | 239 - org.apache.cxf.cxf-rt-transports-http-jetty - 3.1.5.redhat-630187 | Could not load or start org.eclipse.management.MBeanContainer.  Jetty JMX support will not be enabled: org.eclipse.jetty.jmx.MBeanContainer.start()
2021-07-12 14:05:04,957 | INFO  | l Console Thread | ServerImpl                       | 74 - org.apache.cxf.cxf-core - 3.1.5.redhat-630187 | Setting the server's publish address to be http://localhost:9090/employeeservice
2021-07-12 14:05:04,959 | INFO  | l Console Thread | InstrumentationManagerImpl       | 75 - org.apache.cxf.cxf-rt-management - 3.1.5.redhat-630187 | registering MBean org.apache.cxf:bus.id=apache-camel-cxfrs-webservice-cxf1075271344,type=Bus.Service.Endpoint,service="{http://beans.info.tech.basic.the.com/}EmployeeServiceResource",port="EmployeeServiceResource",instance.id=575918874: org.apache.cxf.endpoint.ManagedEndpoint@7d8e2aaa
2021-07-12 14:05:04,963 | INFO  | l Console Thread | InstrumentationManagerImpl       | 75 - org.apache.cxf.cxf-rt-management - 3.1.5.redhat-630187 | registering MBean org.apache.cxf:bus.id=apache-camel-cxfrs-webservice-cxf1075271344,type=Bus.Service.Endpoint,service="{http://beans.info.tech.basic.the.com/}EmployeeServiceResource",port="EmployeeServiceResource",instance.id=575918874: javax.management.modelmbean.RequiredModelMBean@504da65c
2021-07-12 14:05:05,101 | INFO  | l Console Thread | InstrumentationManagerImpl       | 75 - org.apache.cxf.cxf-rt-management - 3.1.5.redhat-630187 | registering MBean io.fabric8.cxf:bus.id=apache-camel-cxfrs-webservice-cxf1075271344,type=Bus.Service.Endpoint,service="{http://beans.info.tech.basic.the.com/}EmployeeServiceResource",port="EmployeeServiceResource",instance.id=575918874: io.fabric8.cxf.endpoint.ManagedApi@13cebcc3
2021-07-12 14:05:05,102 | INFO  | l Console Thread | InstrumentationManagerImpl       | 75 - org.apache.cxf.cxf-rt-management - 3.1.5.redhat-630187 | registering MBean io.fabric8.cxf:bus.id=apache-camel-cxfrs-webservice-cxf1075271344,type=Bus.Service.Endpoint,service="{http://beans.info.tech.basic.the.com/}EmployeeServiceResource",port="EmployeeServiceResource",instance.id=575918874: javax.management.modelmbean.RequiredModelMBean@77962380
2021-07-12 14:05:05,156 | INFO  | l Console Thread | Server                           | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | jetty-9.2.19.v20160908
2021-07-12 14:05:05,171 | WARN  | l Console Thread | AbstractHandler                  | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | No Server set for org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine$1@409cec2
2021-07-12 14:05:05,184 | INFO  | l Console Thread | ServerConnector                  | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started ServerConnector@622069e8{HTTP/1.1}{localhost:9090}
2021-07-12 14:05:05,185 | INFO  | l Console Thread | Server                           | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started @250520ms
2021-07-12 14:05:05,185 | WARN  | l Console Thread | ContextHandler                   | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | Empty contextPath
2021-07-12 14:05:05,188 | INFO  | l Console Thread | ContextHandler                   | 96 - org.eclipse.jetty.util - 9.2.19.v20160908 | Started o.e.j.s.h.ContextHandler@7a63e8d3{/,null,AVAILABLE}
2021-07-12 14:05:05,188 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Route: route_id started and consuming from: Endpoint[cxfrs://bean:cXFRsTest]
2021-07-12 14:05:05,188 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Total 1 routes, of which 1 are started.
2021-07-12 14:05:05,189 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Apache Camel 2.17.0.redhat-630187 (CamelContext: camel_id) started in 0.583 seconds

Download Source Code (Attached)

Keep learning :). Have a great Day. Drop your query in comment box if any.