DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Consuming SOAP Service With Apache CXF and Spring
  • Web Service Testing Using Neoload
  • Spring Boot - How To Use Native SQL Queries | Restful Web Services
  • How to Consume REST Web Service (GET/POST) in Java 11 or Above

Trending

  • The Human Side of Logs: What Unstructured Data Is Trying to Tell You
  • Vibe Coding With GitHub Copilot: Optimizing API Performance in Fintech Microservices
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Event-Driven Architectures: Designing Scalable and Resilient Cloud Solutions
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Exposing and Consuming SOAP Web Service Using Apache Camel-CXF Component and Spring

Exposing and Consuming SOAP Web Service Using Apache Camel-CXF Component and Spring

By 
Roshan Thomas user avatar
Roshan Thomas
·
Mar. 05, 15 · Interview
Likes (0)
Comment
Save
Tweet
Share
52.4K Views

Join the DZone community and get the full member experience.

Join For Free

Let’s take the customer endpoint in my earlier article. Here I am going to use Apache Camel-CXF component to expose this customer endpoint as a web service.

@WebService(serviceName="customerService")
public interface CustomerService 
{
	public Customer getCustomerById(String customerId);

}

public class CustomerEndpoint implements CustomerService
{
	private CustomerEndPointService service;

	@Override
	public Customer getCustomerById(String customerId)
	{
		Customer customer= service.getCustomerById(customerId);
		return customer;
	}

	
}

Exposing the service using Camel-CXF component

<cxf:cxfEndpoint id="customerEndpoint" address="http://localhost:9000/CRMApplication/customer"
            wsdlURL="http://localhost:9000/CRMApplication/customer?wsdl"
            serviceClass="com.sample.services.customers.CustomerService"
            endpointName="ws:CustomerServicePort"
            serviceName="ws:CustomerService"
        xmlns:ws="http://com.sample.customer.endpoint" />

Remember to specify the schema Location and namespace in spring context file

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:cxf="http://camel.apache.org/schema/cxf"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

Consuming SOAP web service using Camel-CXF

Say you have a SOAP web service to the address http://localhost:8181/OrderManagement/order

Then you can invoke this web service from a camel route. Please the code snippet below.

	<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
       <route>
         <from uri="cxf:customerEndpoint" />
         <to uri="http://localhost:8181/OrderManagement/order" />
       </route>
    </camelContext>

In a camel-cxf component you can also specify the data format for an endpoint like given below.

<cxf:cxfEndpoint id="customerEndpoint" address="http://localhost:9000/CRMApplication/customer"
            wsdlURL="http://localhost:9000/CRMApplication/customer?wsdl"
            serviceClass="com.sample.services.customers.CustomerService"
            endpointName="ws:CustomerServicePort"
            serviceName="ws:CustomerService"
        xmlns:ws="http://com.sample.customer.endpoint">
		<cxf:properties>
			<entry key="dataFormat" value="MESSAGE"/>
		</cxf:properties>
	</cxf:cxfEndpoint>

Hope this will help you to create SOAP web service using Camel-CXF component.

Web Service SOAP Web Protocols

Opinions expressed by DZone contributors are their own.

Related

  • Consuming SOAP Service With Apache CXF and Spring
  • Web Service Testing Using Neoload
  • Spring Boot - How To Use Native SQL Queries | Restful Web Services
  • How to Consume REST Web Service (GET/POST) in Java 11 or Above

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: