Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 20. CXF
Expose SOAP WebServices using Apache CXF or connect to external WebServices using CXF WS client.
20.1. What’s inside Copier lienLien copié sur presse-papiers!
There are two URI formats for this endpoint:
- cxf:bean:cxfEndpoint
- cxfEndpoint represents a bean ID that references a bean in the Spring bean registry.
- cxf://someAddress
- someAddress specifies the CXF endpoint’s address.
See the CXF component for usage and configuration details.
20.2. Maven coordinates Copier lienLien copié sur presse-papiers!
Create a new project with this extension on code.quarkus.redhat.com
Or add the coordinates to your existing project:
<dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cxf-soap</artifactId> </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-cxf-soap</artifactId>
</dependency>
20.3. Usage Copier lienLien copié sur presse-papiers!
20.3.1. General Copier lienLien copié sur presse-papiers!
camel-quarkus-cxf-soap
uses extensions from the CXF Extensions for Quarkus project - quarkus-cxf
. This means that quarkus-cxf
provides the set of supported use cases and WS specifications.
To learn about supported use cases and WS specifications, see the Quarkus CXF Reference.
20.3.2. Dependency management Copier lienLien copié sur presse-papiers!
Camel Extensions for Quarkus manages the CXF and quarkus-cxf
versions. You do not need to select compatible versions for those projects.
20.3.3. Client Copier lienLien copié sur presse-papiers!
With camel-quarkus-cxf-soap
(no additional dependencies required), you can use CXF clients as producers in Camel routes:
The CalculatorService
may look like the following:
JAX-WS annotations are required. The Simple CXF Frontend is not supported. Complex parameter types require JAXB annotations to work properly in native mode.
You can test this client application against the quay.io/l2x6/calculator-ws:1.2 container that implements this service endpoint interface:
docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.2
$ docker run -p 8082:8080 quay.io/l2x6/calculator-ws:1.2
quarkus-cxf
supports injecting SOAP clients using @io.quarkiverse.cxf.annotation.CXFClient
annotation. Refer to the SOAP Clients chapter of the quarkus-cxf
user guide for more details.
20.3.4. Server Copier lienLien copié sur presse-papiers!
With camel-quarkus-cxf-soap
, you can expose SOAP endpoints as consumers in Camel routes. No additional dependencies are required for this use case.
The path for these two services depends on the value of the quarkus.cxf.path
configuration property which can for example be set in application.properties
:
application.properties
quarkus.cxf.path = /soap-services
quarkus.cxf.path = /soap-services
With this configuration in place, you can access the two services at http://localhost:8080/soap-services/hello-bean
and http://localhost:8080/soap-services/hello-inline
, respectively.
You can access the WSDL by adding ?wsdl
to the above URLs.
Do not use quarkus.cxf.path = /
in your application unless you are 100% sure no other extension will want to expose HTTP endpoints.
As of CEQ 2.13.3 the default value of quarkus.cxf.path
is /
. The default value will prevent other extensions from exposing HTTP endpoints.
This affects RESTEasy, Vert.x, SmallRye Health and others. If you use any of them, you should set quarkus.cxf.path
to some specific path, such as /services
, which is the default starting with Camel Extensions for Quarkus 3.0.0
/ quarkus-cxf 2.0.0
.
quarkus-cxf
supports alternative ways of exposing SOAP endpoints. Refer to the SOAP Services chapter of the quarkus-cxf
user guide for more details.
20.3.5. Logging of requests and responses Copier lienLien copié sur presse-papiers!
You can enable verbose logging of SOAP messages for clients and servers with org.apache.cxf.ext.logging.LoggingFeature
:
io.quarkiverse.cxf:quarkus-cxf-rt-features-logging
provides support for org.apache.cxf.ext.logging.LoggingFeature
as a camel-quarkus-cxf-soap
dependency.
You do not need to add it explicitly to your application.
20.3.6. WS Specifications Copier lienLien copié sur presse-papiers!
The extent of supported WS specifications is given by the Quarkus CXF project.
To learn about supported use cases and WS specifications, see the Quarkus CXF Reference.
If your application requires some other WS specification, you must add a Quarkus CXF dependency covering it.
In Camel Extensions for Quarkus we support all extensions listed with the support level Stable
.
You can use integration tests as executable examples of applications that implement various WS specifications:
20.3.7. Tooling Copier lienLien copié sur presse-papiers!
quarkus-cxf
wraps the following two CXF tools:
-
wsdl2Java
- for generating service classes from WSDL -
java2ws
- for generating WSDL from Java classes
For wsdl2Java
to work properly, your application must directly depend on io.quarkiverse.cxf:quarkus-cxf
.
While wsdlvalidator
is not supported, you can use wsdl2Java
with the following configuration in application.properties
to validate your WSDLs:
application.properties
quarkus.cxf.codegen.wsdl2java.additional-params = -validate
quarkus.cxf.codegen.wsdl2java.additional-params = -validate