<commit_before>---
title: Karaf Tutorial Part 4 - CXF Services in OSGi
---

Shows how to publish and use a simple REST and SOAP service in karaf using cxf and blueprint.

To run the example you need to install the http feature of karaf. The default http port is 8080 and can be configured using the
config admin pid "org.ops4j.pax.web". You also need to install the cxf feature. The base url of the cxf servlet is by default "/cxf".
It can be configured in the config pid "org.apache.cxf.osgi".

If you use Talend ESB instead of plain karaf then the default http port is 8044 and the default cxf servlet name is "/services".

## PersonService Example

You can find the [full source on github(https://github.com/cschneider/Karaf-Tutorial/tree/master/cxf/personservice/).

The "business case" is to manage a list of persons. As service should provide the typical CRUD operations. Front ends should be a REST service, a SOAP service and a web UI.

![Image](Overview.png)

The example consists of four projects

- model - Person class and PersonService interface
- server - Service implementation and logic to publish the service using jax-ws (SOAP)
- proxy - Accesses the SOAP service and publishes it as an OSGi service
- webui - Provides a simple servlet based web ui to list and add persons. Uses the OSGi service

## Installation and test run

First we build, install and run the example to give an overview of what it does. The following main chapter then explains in detail how it works.<commit_msg>Update index.md<commit_after>---
title: Karaf Tutorial Part 4 - CXF Services in OSGi
---

Shows how to publish and use a simple REST and SOAP service in karaf using cxf and blueprint.

To run the example you need to install the http feature of karaf. The default http port is 8080 and can be configured using the
config admin pid "org.ops4j.pax.web". You also need to install the cxf feature. The base url of the cxf servlet is by default "/cxf".
It can be configured in the config pid "org.apache.cxf.osgi".

If you use Talend ESB instead of plain karaf then the default http port is 8044 and the default cxf servlet name is "/services".

## PersonService Example

You can find the [full source on github](https://github.com/cschneider/Karaf-Tutorial/tree/master/cxf/personservice/).

The "business case" is to manage a list of persons. As service should provide the typical CRUD operations. Front ends should be a REST service, a SOAP service and a web UI.

![Image](Overview.png)

The example consists of four projects

- model - Person class and PersonService interface
- server - Service implementation and logic to publish the service using jax-ws (SOAP)
- proxy - Accesses the SOAP service and publishes it as an OSGi service
- webui - Provides a simple servlet based web ui to list and add persons. Uses the OSGi service

## Installation and test run

First we build, install and run the example to give an overview of what it does. The following main chapter then explains in detail how it works.
{'fraction_non_alphanumeric': 0.05453940804788826, 'fraction_numerical': 0.006651147322913203, 'mean_word_length': 3.8594507269789986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5956169', 'n_tokens_mistral': 841, 'n_tokens_neox': 804, 'n_words': 472}