FUSE 6.1 Camel Cxf Basic Auth doesn't work (ignored)
n1ppl3 Jan 23, 2016 8:16 AMHi, I'm studying OSGi Camel basics and trying to make simple Camel route which starts with cxfEndpoint. I successfully made it.
Now I want to add basic authentication to my cxfEndpoint and use <http:conduit /> element for this purposes. But this solution doesn't work, conduit is ignored...
What am I doing wrong? Help me, please.
I use jboss-fuse-6.1.0.redhat-379 and jdk1.6.23 (32 bit) on 32-bit Windows machine
META-INF/spring/my-spring-context.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cml="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 "> <!-- Bridge Spring property placeholder with Camel --> <!-- Do not use <ctx:property-placeholder ... > at the same time --> <bean id="moduleProperties" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"> <property name="location" value="classpath:module.properties" /> </bean> </beans>
META-INF/spring/my-camel-context.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cml="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 "> <camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring"> <route id="myRoute"> <from uri="cxf:bean:misClientsWS" /> <process ref="inProcessor" /> </route> </camelContext> <bean id="inProcessor" class="ru.troika.ccit.InProcessor" /> </beans>
META-INF/spring/my-cxf-context.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cml="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 "> <!-- will be available at http://localhost:8181/cxf/misClientsWS?wsdl where 8181 is the port defined in jetty.xml --> <cxf:cxfEndpoint id="misClientsWS" serviceClass="ru.troika.ccit.MisClientsWS" address="/misClientsWS"> <cxf:properties> <entry key="dataFormat" value="POJO" /> <entry key="faultStackTraceEnabled" value="true" /> <entry key="exceptionMessageCauseEnabled" value="true" /> </cxf:properties> </cxf:cxfEndpoint> </beans>
META-INF/spring/cxf-security-basic-auth.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:cml="http://camel.apache.org/schema/spring" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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 http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd "> <http:conduit name="*.http-conduit"> <http:authorization> <sec:UserName>sa</sec:UserName> <sec:Password>sa</sec:Password> <sec:AuthorizationType>Basic</sec:AuthorizationType> </http:authorization> </http:conduit> </beans>
pom.xml
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Description>${project.description}</Bundle-Description>
<Import-Package>
org.apache.cxf.bus.spring,
org.apache.cxf.binding.soap,
org.apache.cxf.binding.soap.spring,
org.springframework.beans.factory.config,
javax.jws,
javax.wsdl,
javax.xml.namespace,
*
</Import-Package>
<Export-Package>ru.troika.ccit</Export-Package>
</instructions>
</configuration>
</plugin>