CXF With JBoss Tutorial

CXF With JBoss Tutorial explains about the integration of CXF Framework with Jboss server.

Apache CXF is a free and open source project, and a fully featured Webservice framework.It helps you building webservices using different front-end API's, like as JAX-RS and JAX-WS.

Reference →


You can also read  about implementing an Asynchronous service Asynchronous Web Service Using CXF

Required Libraries

You need to download

  1. JDK 8
  2. Eclipse 4.5
  3. CXF-3.1.4
  4. JBoss EAP 6.4

Following jar must be in classpath

  1. aopalliance-1.0.jar
  2. asm-5.0.4.jar
  3. cxf-core-3.1.4.jar
  4. cxf-rt-bindings-soap-3.1.4.jar
  5. cxf-rt-databinding-jaxb-3.1.4.jar
  6. cxf-rt-frontend-jaxws-3.1.4.jar
  7. cxf-rt-frontend-simple-3.1.4.jar
  8. cxf-rt-transports-http-3.1.4.jar
  9. cxf-rt-ws-policy-3.1.4
  10. cxf-rt-wsdl-3.1.4.jar
  11. jaxb-core-2.2.11.jar
  12. jaxb-impl-2.2.11.jar
  13. jcl-over-slf4j-1.7.12.jar
  14. neethi-3.0.3.jar
  15. slf4j-api-1.7.12.jar
  16. slf4j-jdk14-1.7.12.jar
  17. spring-aop-4.1.7.RELEASE.jar
  18. spring-beans-4.1.7.RELEASE.jar
  19. spring-context-4.1.7.RELEASE.jar
  20. spring-core-4.1.7.RELEASE.jar
  21. spring-expression-4.1.7.RELEASE.jar
  22. spring-web-4.1.7.RELEASE.jar
  23. stax2-api-3.1.4.jar
  24. woodstox-core-asl-4.4.1.jar
  25. wsdl4j-1.6.3.jar
  26. xml-resolver-1.2.jar
  27. xmlschema-core-2.2.1.jar

CXF JBoss Tutorial

I am creating a sample web service project that pass Student object and return with some changes on that object. The service is using simple POJO (Plain Old Java Object) bean.

Firstly create a Dynamic Web Project (File->New->Dynamic Web Project) named "CXFTutorial" according to following screenshot

Create CXF Project CXF JBoss Tutorial

Create a Student Object

package com.student;

public class Student {
private String name;
public String getName() {
return name;
public void setName(String name) { = name;

Create a Service Interface

This service interface will defines which methods of web service, to be invoked by the client

package com.student;

import javax.jws.WebService;

public interface ChangeStudentDetails {
Student changeName(Student student);

Implement the Service Interface

Here we implement the service interface created on the previous step

package com.student;

import javax.jws.WebService;

@WebService(endpointInterface = "com.student.ChangeStudentDetails")
public class ChangeStudentDetailsImpl implements ChangeStudentDetails {
public Student changeName(Student student) {
student.setName("Hello "+student.getName());
return student;

Create a cxf.xml

CXF is using Spring internally, Finding classes by spring we need to add service implementation class on "jaxws:endpoint" tag

<beans xmlns=""
	xmlns:xsi="" xmlns:jaxws=""

	<jaxws:endpoint id="changeStudent"
		implementor="com.student.ChangeStudentDetailsImpl" address="/ChangeStudent" />


Change web.xml

Change the web.xml file to find CXF servlet and cxf.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xsi:schemaLocation="" id="WebApp_ID" version="3.1">

Publishing CXF Web Service

Run CXF On JBoss

Run CXF On JBoss


You can Find all the deployed JAX-WS/JAX-RS services you need to append 'services' at the end of the URL so URL will become following


Deployed CXF Web Service

CXF WebService Running


you can also see CXF client example in order to run this service

1 Responses to "CXF With JBoss Tutorial"
  1. sistemas 2017-11-02 12:58:32.0

Your email address will not be published. Required fields are marked *