Chapter 6. Securing the Camel CXF Component
6.1. The Camel CXF Proxy Demonstration
Figure 6.1. Camel CXF Proxy Overview
RealWebServiceBean, receives details of an incident (for example, a traffic accident) and returns a tracking code to the client. Instead of sending its requests directly to the real Web service, however, the WS client connects to a Camel CXF endpoint, which is interposed between the WS client and the real Web service. The Apache Camel route performs some processing on the WSDL message (using the
enrichBean) before forwarding it to the real Web service.
- SSL/TLS security is enabled on the connection between the WS client and the Camel CXF endpoint.
- The Apache Camel route and the
RealWebServiceBeanbean are both deployed into the OSGi container.
Obtaining the demonstration code
InstallDir/extrasdirectory. Using a standard archive utility, expand the Camel archive file and extract the contents to a convenient location on your filesystem.
Obtaining the sample certificates
wsdl_first_httpexample. This demonstration is available from the standalone distribution of Apache CXF, which is included in the
InstallDir/extrasdirectory. Using a standard archive utility, expand the CXF archive file and extract the contents to a convenient location on your filesystem.
wsdl_first_httpdemonstration in the following directory:
Physical part of the WSDL contract
wsdl:portelements. These elements specify the transport details that are needed to connect to a specific Web services endpoint. For the purposes of this demonstration, this is the most interesting part of the contract and it is shown in Example 6.1, “The ReportIncidentEndpointService WSDL Service”.
Example 6.1. The ReportIncidentEndpointService WSDL Service
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" ... xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://reportincident.example.camel.apache.org"> ... <!-- Service definition --> <wsdl:service name="ReportIncidentEndpointService"> <wsdl:port name="ReportIncidentEndpoint" binding="tns:ReportIncidentBinding"> <soap:address location="http://localhost:9080/camel-example-cxf-proxy/webservices/incident"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
locationattribute) is not important here, because the application code overrides the default value of the address URL.
WSDL addressing details
- WSDL service name
- The full QName of the WSDL service is as follows:
- WSDL port name
- The full QName of the WSDL port is as follows:
- Address URL
- The address URL of the proxy Web service endpoint (which uses the HTTPS protocol) is as follows:
https://localhost:9080/camel-example-cxf-proxy/webservices/incidentNoteThe preceding address is specified when the
reportIncidentbean is created using a
cxf:cxfEndpointelement in the bundle's Spring configuration file,
src/main/resources/META-INF/spring/camel-config.xml.The address URL of the real Web service endpoint (using the HTTP protocol) is as follows:
http://localhost:9081/real-webserviceNoteThe preceding address is specified when the
realWebServicebean is created in the bundle's Spring configuration file,