/spring-boot-cxf-jaxws-xml

Primary LanguageJavaApache License 2.0Apache-2.0

Spring-Boot Camel CXF JAXWS QuickStart

This example demonstrates how you can use Apache CXF with Spring Boot(xml way to publish the JAXWS endpoint) based on a fabric8 Java base image.

Important
This quickstart can run in 2 modes: standalone on your machine and on Kubernetes / OpenShift Cluster

Deployment options

You can run this quickstart in the following modes:

  • Kubernetese / Single-node OpenShift cluster

  • Standalone on your machine

The most effective way to run this quickstart is to deploy and run the project on OpenShift.

For more details about running this quickstart on a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the Spring Boot Runtime Guide.

Running the Quickstart on a single-node Kubernetes/OpenShift cluster

A single-node Kubernetes/OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.

If you have a single-node Kubernetes/OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, installed and running, you can deploy your quickstart there.

To deploy this quickstart to a running single-node OpenShift cluster:

  1. Download the project and extract the archive on your local filesystem.

  2. Log in to your OpenShift cluster:

    $ oc login -u developer -p developer
  3. Create a new OpenShift project for the quickstart:

    $ oc new-project MY_PROJECT_NAME
  4. Change the directory to the folder that contains the extracted quickstart application (for example, my_openshift/spring-boot-camel-jaxws-xml) :

    $ cd my_openshift/spring-boot-camel-jaxws-xml
  5. Build and deploy the project to the OpenShift cluster:

    $ mvn clean -DskipTests fabric8:deploy -Popenshift
  6. In your browser, navigate to the MY_PROJECT_NAME project in the OpenShift console. Wait until you can see that the pod for the spring-boot-camel-jaxws-xml has started up.

Accessing the CXF JAXRS endpoint

When the example is running, a CXF JAXRS endpoint is available.

If you run the example on a single-node OpenShift cluster, then the REST service is exposed at 'http://spring-boot-camel-jaxws-xml-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io/service`.

Notice: As it depends on your OpenShift setup, the hostname (route) might vary. Verify with oc get routes which hostname is valid for you.

Integration Testing

The example includes a fabric8 arquillian Kubernetes Integration Test. Once the container image has been built and deployed in Kubernetes, the integration test can be run with:

mvn test -Dtest=*KT

The test is disabled by default and has to be enabled using -Dtest. Integration Testing and Fabric8 Arquillian Extension provide more information on writing full fledged black box integration tests for Kubernetes.

Running the quickstart standalone on your machine

To run this quickstart as a standalone project on your local machine:

  1. Download the project and extract the archive on your local filesystem.

  2. Build the project:

    $ cd PROJECT_DIR
    $ mvn clean package
  3. Run the service:

    $ mvn spring-boot:run

You can then access the CXF JAXRS endpoint directly from your Web browser, e.g.: