META-INF.spring.camel-context.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of camel-example-reportincident-wssecurity Show documentation
Show all versions of camel-example-reportincident-wssecurity Show documentation
An example based on real life use case for reporting incidents using webservice that are transformed
and send as emails to a backing system. Client calling the WebService is authentified through WS-Security
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd"> <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/> <bean id="wss4jInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> <constructor-arg> <map> <entry key="action" value="UsernameToken Timestamp"/> <entry key="passwordType" value="PasswordDigest"/> <entry key="passwordCallbackClass" value="org.apache.camel.example.reportincident.UTPasswordCallback"/> </map> </constructor-arg> </bean> <!-- <bean id="wss4jOutInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> <constructor-arg> <map> <entry key="action" value="UsernameToken Timestamp"/> <entry key="passwordType" value="PasswordText"/> <entry key="user" value="Alice"/> <entry key="passwordCallbackClass" value="org.apache.camel.example.reportincident.UTPasswordCallback"/> </map> </constructor-arg> </bean> --> <cxf:cxfEndpoint id="reportIncident" address="http://localhost:{{port}}/camel-example-reportincident/webservices/incident" wsdlURL="etc/report_incident.wsdl" serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"> <cxf:inInterceptors> <ref bean="loggingInInterceptor"/> <ref bean="wss4jInInterceptor"/> </cxf:inInterceptors> <cxf:outInterceptors> <ref bean="loggingOutInterceptor"/> <!-- <ref bean="wss4jOutInterceptor"/> --> </cxf:outInterceptors> </cxf:cxfEndpoint> <bean id="myBean" class="org.apache.camel.example.reportincident.MyBean"/> <bean id="filenameGenerator" class="org.apache.camel.example.reportincident.FilenameGenerator"/> <camel:camelContext id="camel"> <!-- property which contains port number --> <camel:propertyPlaceholder id="properties" ignoreMissingLocation="true" location="classpath:incident.properties,file:target/custom.properties"/> <camel:route> <camel:from uri="cxf:bean:reportIncident"/> <camel:convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident"/> <camel:setHeader headerName="CamelFileName"> <camel:method bean="filenameGenerator" method="generateFilename"/> </camel:setHeader> <camel:to uri="velocity:etc/MailBody.vm"/> <camel:to uri="file://target/subfolder"/> <camel:transform> <camel:method bean="myBean" method="getOK"/> </camel:transform> </camel:route> <camel:route> <camel:from uri="file://target/subfolder"/> <camel:setHeader headerName="subject"> <camel:constant>new incident reported</camel:constant> </camel:setHeader> <camel:to uri="log:com.mycompany.incident?level=INFO"/> <camel:to uri="smtp://someone@localhost?password=secret&to=incident@localhost"/> </camel:route> </camel:camelContext> </beans>