Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Questo contenuto non è disponibile nella lingua selezionata.
40.3. Instantiate the WS Endpoint
Overview Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
In Apache Camel, the CXF component is the key to integrating routes with Web services. You can use the CXF component to create two different kinds of endpoint:
- Consumer endpoint—(at the start of a route) represents a Web service instance, which integrates with the route. The type of payload injected into the route depends on the value of the endpoint's
dataFormat
option. - Producer endpoint—represents a special kind of WS client proxy, which converts the current exchange object into an operation invocation on a remote Web service. The format of the current exchange must match the endpoint's
dataFormat
setting.
The cxf:bean: URI syntax Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The
cxf:bean:
URI is used to bind an Apache CXF endpoint to a route and has the following general syntax:
cxf:bean:CxfEndpointID[?Options]
cxf:bean:CxfEndpointID[?Options]
Where
CxfEndpointID
is the ID of a bean created using the cxf:cxfEndpoint
element, which configures the details of the WS endpoint. You can append options to this URI (where the options are described in detail in CXF in the Apache Camel Component Reference Guide ). Provider mode is essentially a variant of PAYLOAD mode: you could specify this mode on the URI (by setting dataFormat=PAYLOAD
), but this is not necessary, because PAYLOAD mode is already selected by the @ServiceMode
annotation on the custom Provider
class.
For example, to start a route with an endpoint in provider mode, where the endpoint is configured by the
customer-ws
bean, define the route as follows:
<route> <from uri="cxf:bean:customer-ws"/> ... </route>
<route>
<from uri="cxf:bean:customer-ws"/>
...
</route>
The cxf:cxfEndpoint element Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The
cxf:cxfEndpoint
element is used to define a WS endpoint that binds either to the start (consumer endpoint) or the end (producer endpoint) of a route. For example, to define the customer-ws
WS endpoint in provider mode, you define a cxf:cxfEndpoint
element as follows:
Specifying the WSDL location Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The
wsdlURL
attribute of the cxf:cxfEndpoint
element is used to specify the location of the WSDL contract for this endpoint. The WSDL contract is used as the source of metadata for this endpoint.
Specifying the service class Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
A key difference between provider mode and ordinary PAYLOAD mode is that the
serviceClass
attribute must be set to the provider class, SAXSourceService
.