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

In today’s blog, we will learn to implement a simple Apache Camel CXF SOAP Webservice and deploy it on Red Hat JBoss Fuse.

In this example we are exposing an endpoint as SOAP 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

Apache Cxf Soap Webservice

Create WSDL : thebasictechinfo.wsdl

We need to create a WSDL file for exposing SOAP Webservices

<?xml version="1.0" encoding="ISO-8859-1"?>

<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="https://thebasictechinfo.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	targetNamespace="https://thebasictechinfo.com">

	<wsdl:types>
		<xs:schema targetNamespace="https://thebasictechinfo.com">
			<xs:element name="inputSOATest">
				<xs:complexType>
					<xs:sequence>
						<xs:element type="xs:string" name="test" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="outputSOATest">
				<xs:complexType>
					<xs:sequence>
						<xs:element type="xs:string" name="result" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:schema>
	</wsdl:types>

	<!-- Define input and output parameters -->
	<wsdl:message name="inputSOATest">
		<wsdl:part name="in" element="tns:inputSOATest" />
	</wsdl:message>
	<wsdl:message name="outputSOATest">
		<wsdl:part name="out" element="tns:outputSOATest" />
	</wsdl:message>

	<!-- Define port definition -->
	<wsdl:portType name="SOATestEndpoint">
		<wsdl:operation name="SOATest">
			<wsdl:input message="tns:inputSOATest" />
			<wsdl:output message="tns:outputSOATest" />
		</wsdl:operation>
	</wsdl:portType>

	<!-- Bind SOAP operation and service -->
	<wsdl:binding name="SOATestBinding" type="tns:SOATestEndpoint">
		<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
		<wsdl:operation name="SOATest">
			<soap:operation soapAction="https://thebasictechinfo.com" style="document" />
			<wsdl:input>
				<soap:body parts="in" use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:body parts="out" use="literal" />
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>

	<!--Define Service -->
	<wsdl:service name="SOATestEndpointService">
		<wsdl:port name="SOATestEndpoint" binding="tns:SOATestBinding">
			<soap:address location="http://localhost:8181/cxf/thebasictechinfo/service" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

Maven File: pom.xml

We need to add camel-cxf maven dependency with cxf-codegen-plugin in maven pom.xml 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-cxf-webservice</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>bundle</packaging>
	<name>apache-camel-cxf-webservice</name>
	<description>Apache Camel Cxf Blueprint</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-cxf-webservice</Bundle-SymbolicName>
						<Bundle-Name>Empty Camel Blueprint Example [apache-camel-cxf-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>
			<plugin>
				<groupId>org.apache.cxf</groupId>
				<artifactId>cxf-codegen-plugin</artifactId>

				<executions>
					<execution>
						<id>generate-sources</id>
						<phase>generate-sources</phase>
						<configuration>
							<sourceRoot>${basedir}/src/main/java</sourceRoot>
							<wsdlOptions>
								<wsdlOption>
									<wsdl>${basedir}/src/main/resources/wsdl/thebasictechinfo.wsdl</wsdl>
								</wsdlOption>
							</wsdlOptions>
						</configuration>
						<goals>
							<goal>wsdl2java</goal>
						</goals>
					</execution>
				</executions>
			</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">

	<!--cxfEndpoint -->
	<cxf:cxfEndpoint id="cXFTest" address="/thebasictechinfo/service" endpointName="a:SOATestEndpoint" serviceName="a:SOATestEndpointService" wsdlURL="wsdl/thebasictechinfo.wsdl" serviceClass="com.thebasictechinfo.SOATestEndpoint" xmlns:a="https://thebasictechinfo.com" />

	<bean id="processor" class="com.the.basic.tech.info.beans.CamelProcessor" />
	<camelContext id="camel_id" xmlns="http://camel.apache.org/schema/blueprint">

		<route id="route_id">
			<from uri="cxf:bean:cXFTest" />
			<process ref="processor" />
		</route>

	</camelContext>
</blueprint>

Camel Custom Processor : CamelProcessor.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 java.util.List;

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

import com.thebasictechinfo.InputSOATest;
import com.thebasictechinfo.OutputSOATest;

public class CamelProcessor implements Processor {

	public void process(Exchange exchange) throws Exception {
		OutputSOATest out = new OutputSOATest();

		// Get input from exchange
		List<?> soaList = exchange.getIn().getBody(List.class);
		InputSOATest inputSOATest = (InputSOATest) soaList.get(0);

		// Set output into exchange
		out.setResult("Welcome " + inputSOATest.getTest().toString());
		exchange.getOut().setBody(out);
	}

}

cxf-codegen-plugin : generate-sources plugin

This plugin will be using for generating java stub from WSDL file. Once, we complie/build the project following java classes will be generated automatically.


package com.thebasictechinfo;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="test" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "test"
})
@XmlRootElement(name = "inputSOATest")
public class InputSOATest {

    @XmlElement(required = true)
    protected String test;

    /**
     * Gets the value of the test property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getTest() {
        return test;
    }

    /**
     * Sets the value of the test property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setTest(String value) {
        this.test = value;
    }

}

package com.thebasictechinfo;

import javax.xml.bind.annotation.XmlRegistry;


/**
 * This object contains factory methods for each 
 * Java content interface and Java element interface 
 * generated in the com.thebasictechinfo package. 
 * <p>An ObjectFactory allows you to programatically 
 * construct new instances of the Java representation 
 * for XML content. The Java representation of XML 
 * content can consist of schema derived interfaces 
 * and classes representing the binding of schema 
 * type definitions, element declarations and model 
 * groups.  Factory methods for each of these are 
 * provided in this class.
 * 
 */
@XmlRegistry
public class ObjectFactory {


    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.thebasictechinfo
     * 
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link InputSOATest }
     * 
     */
    public InputSOATest createInputSOATest() {
        return new InputSOATest();
    }

    /**
     * Create an instance of {@link OutputSOATest }
     * 
     */
    public OutputSOATest createOutputSOATest() {
        return new OutputSOATest();
    }

}

package com.thebasictechinfo;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType&gt;
 *   &lt;complexContent&gt;
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
 *       &lt;sequence&gt;
 *         &lt;element name="result" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
 *       &lt;/sequence&gt;
 *     &lt;/restriction&gt;
 *   &lt;/complexContent&gt;
 * &lt;/complexType&gt;
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "result"
})
@XmlRootElement(name = "outputSOATest")
public class OutputSOATest {

    @XmlElement(required = true)
    protected String result;

    /**
     * Gets the value of the result property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getResult() {
        return result;
    }

    /**
     * Sets the value of the result property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setResult(String value) {
        this.result = value;
    }

}
@javax.xml.bind.annotation.XmlSchema(namespace = "https://thebasictechinfo.com")
package com.thebasictechinfo;
package com.thebasictechinfo;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;

/**
 * This class was generated by Apache CXF 3.4.4
 * 2021-07-11T22:57:00.701+05:30
 * Generated source version: 3.4.4
 *
 */
@WebService(targetNamespace = "https://thebasictechinfo.com", name = "SOATestEndpoint")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SOATestEndpoint {

    @WebMethod(operationName = "SOATest", action = "https://thebasictechinfo.com")
    @WebResult(name = "outputSOATest", targetNamespace = "https://thebasictechinfo.com", partName = "out")
    public OutputSOATest soaTest(

        @WebParam(partName = "in", name = "inputSOATest", targetNamespace = "https://thebasictechinfo.com")
        InputSOATest in
    );
}
package com.thebasictechinfo;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;

/**
 * This class was generated by Apache CXF 3.4.4
 * 2021-07-11T22:57:00.708+05:30
 * Generated source version: 3.4.4
 *
 */
@WebServiceClient(name = "SOATestEndpointService",
                  wsdlLocation = "file:/D:/localworkspace/apache-camel-cxf-webservice/src/main/resources/wsdl/thebasictechinfo.wsdl",
                  targetNamespace = "https://thebasictechinfo.com")
public class SOATestEndpointService extends Service {

    public final static URL WSDL_LOCATION;

    public final static QName SERVICE = new QName("https://thebasictechinfo.com", "SOATestEndpointService");
    public final static QName SOATestEndpoint = new QName("https://thebasictechinfo.com", "SOATestEndpoint");
    static {
        URL url = null;
        try {
            url = new URL("file:/D:/localworkspace/apache-camel-cxf-webservice/src/main/resources/wsdl/thebasictechinfo.wsdl");
        } catch (MalformedURLException e) {
            java.util.logging.Logger.getLogger(SOATestEndpointService.class.getName())
                .log(java.util.logging.Level.INFO,
                     "Can not initialize the default wsdl from {0}", "file:/D:/localworkspace/apache-camel-cxf-webservice/src/main/resources/wsdl/thebasictechinfo.wsdl");
        }
        WSDL_LOCATION = url;
    }

    public SOATestEndpointService(URL wsdlLocation) {
        super(wsdlLocation, SERVICE);
    }

    public SOATestEndpointService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public SOATestEndpointService() {
        super(WSDL_LOCATION, SERVICE);
    }

    public SOATestEndpointService(WebServiceFeature ... features) {
        super(WSDL_LOCATION, SERVICE, features);
    }

    public SOATestEndpointService(URL wsdlLocation, WebServiceFeature ... features) {
        super(wsdlLocation, SERVICE, features);
    }

    public SOATestEndpointService(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
        super(wsdlLocation, serviceName, features);
    }




    /**
     *
     * @return
     *     returns SOATestEndpoint
     */
    @WebEndpoint(name = "SOATestEndpoint")
    public SOATestEndpoint getSOATestEndpoint() {
        return super.getPort(SOATestEndpoint, SOATestEndpoint.class);
    }

    /**
     *
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
     * @return
     *     returns SOATestEndpoint
     */
    @WebEndpoint(name = "SOATestEndpoint")
    public SOATestEndpoint getSOATestEndpoint(WebServiceFeature... features) {
        return super.getPort(SOATestEndpoint, SOATestEndpoint.class, features);
    }

}

Application Logging : Log4j.properties

#
# The logging properties used for testing
#
log4j.rootLogger=INFO, out

#log4j.logger.org.apache.camel=DEBUG

# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

# File appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
log4j.appender.file.file=target/camel-test.log

OSGI Bundle : Build, Install, Deploy

To build this project use below command.

D:\localworkspace\apache-camel-cxf-webservice>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building apache-camel-cxf-webservice 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ apache-camel-cxf-webservice ---
[INFO] Deleting D:\localworkspace\apache-camel-cxf-webservice\target
[INFO]
[INFO] --- cxf-codegen-plugin:3.4.4:wsdl2java (generate-sources) @ apache-camel-cxf-webservice ---
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ apache-camel-cxf-webservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ apache-camel-cxf-webservice ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to D:\localworkspace\apache-camel-cxf-webservice\target\classes
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ apache-camel-cxf-webservice ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\localworkspace\apache-camel-cxf-webservice\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ apache-camel-cxf-webservice ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ apache-camel-cxf-webservice ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:bundle (default-bundle) @ apache-camel-cxf-webservice ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ apache-camel-cxf-webservice ---
[INFO] Installing D:\localworkspace\apache-camel-cxf-webservice\target\apache-camel-cxf-webservice-1.0.0-SNAPSHOT.jar to C:\Users\172025\.m2\repository\com\the\basic\tech\info\apache-camel-cxf-webservice\1.0.0-SNAPSHOT\apache-camel-cxf-webservice-1.0.0-SNAPSHOT.jar
[INFO] Installing D:\localworkspace\apache-camel-cxf-webservice\pom.xml to C:\Users\172025\.m2\repository\com\the\basic\tech\info\apache-camel-cxf-webservice\1.0.0-SNAPSHOT\apache-camel-cxf-webservice-1.0.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-bundle-plugin:3.2.0:install (default-install) @ apache-camel-cxf-webservice ---
[INFO] Installing com/the/basic/tech/info/apache-camel-cxf-webservice/1.0.0-SNAPSHOT/apache-camel-cxf-webservice-1.0.0-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.541 s
[INFO] Finished at: 2021-07-11T22:16:40+05:30
[INFO] Final Memory: 38M/293M
[INFO] ------------------------------------------------------------------------

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.

osgi:install -s mvn:com.the.basic.tech.info/apache-camel-cxf-webservice/1.0.0-SNAPSHOT
JBossFuse:karaf@root> osgi:install -s mvn:com.the.basic.tech.info/apache-camel-cxf-webservice/1.0.0-SNAPSHOT
Bundle ID: 293
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)
[ 293] [Active     ] [Created     ] [       ] [   80] Empty Camel Blueprint Example [apache-camel-cxf-webservice] (1.0.0.SNAPSHOT)
JBossFuse:karaf@root> log:tail
2021-07-11 22:17:27,423 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Starting JMX OSGi agent
2021-07-11 22:17:27,461 | 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=6cca021c-f954-453c-875c-eb9f8160e5b5] for service with service.id [13]
2021-07-11 22:17:27,465 | INFO  | FelixStartLevel  | core                             | 48 - org.apache.aries.jmx.core - 1.1.3 | Registering org.osgi.jmx.framework.ServiceStateMBean to MBeanServer com.sun.jmx.mbeanserver.JmxMBeanServer@7440e464 with name osgi.core:type=serviceState,version=1.7,framework=org.apache.felix.framework,uuid=6cca021c-f954-453c-875c-eb9f8160e5b5

Access Cxf End Points

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

SoapUI : Test Apache CXF Soap Webservice

Create Project in SoapUI with WSDL Url : http://localhost:8181/cxf/thebasictechinfo/service?wsdl

Click on OK button it will create SOAP project in SoapUI

SoapUI : Submit SOAP Request

We will get below response from SOAP Webservice.

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

2021-07-11 22:18:21,899 | 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) is starting
2021-07-11 22:18:21,903 | INFO  | l Console Thread | ManagedManagementStrategy        | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | JMX is enabled
2021-07-11 22:18:22,092 | 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-11 22:18:22,308 | 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-11 22:18:22,308 | 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-11 22:18:22,392 | INFO  | l Console Thread | ReflectionServiceFactoryBean     | 77 - org.apache.cxf.cxf-rt-wsdl - 3.1.5.redhat-630187 | Creating Service {https://thebasictechinfo.com}SOATestEndpointService from WSDL: wsdl/thebasictechinfo.wsdl
2021-07-11 22:18:23,098 | INFO  | l Console Thread | ServerImpl                       | 74 - org.apache.cxf.cxf-core - 3.1.5.redhat-630187 | Setting the server's publish address to be /thebasictechinfo/service
2021-07-11 22:18:23,100 | 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-cxf-webservice-cxf82594688,type=Bus.Service.Endpoint,service="{https://thebasictechinfo.com}SOATestEndpointService",port="SOATestEndpoint",instance.id=1658498922: org.apache.cxf.endpoint.ManagedEndpoint@338a6e4b
2021-07-11 22:18:23,104 | 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-cxf-webservice-cxf82594688,type=Bus.Service.Endpoint,service="{https://thebasictechinfo.com}SOATestEndpointService",port="SOATestEndpoint",instance.id=1658498922: javax.management.modelmbean.RequiredModelMBean@177cb742
2021-07-11 22:18:23,115 | 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-cxf-webservice-cxf82594688,type=Bus.Service.Endpoint,service="{https://thebasictechinfo.com}SOATestEndpointService",port="SOATestEndpoint",instance.id=1658498922: io.fabric8.cxf.endpoint.ManagedApi@3fd78c59
2021-07-11 22:18:23,117 | 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-cxf-webservice-cxf82594688,type=Bus.Service.Endpoint,service="{https://thebasictechinfo.com}SOATestEndpointService",port="SOATestEndpoint",instance.id=1658498922: javax.management.modelmbean.RequiredModelMBean@1d3c289e
2021-07-11 22:18:23,193 | INFO  | l Console Thread | BlueprintCamelContext            | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Route: route_id started and consuming from: Endpoint[cxf://bean:cXFTest]
2021-07-11 22:18:23,194 | 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-11 22:18:23,195 | 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 1.295 seconds

Download Source Code (Attached)

Thank you. Have a fantastic day 🙂