You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Naveen Vangipurapu <nv...@infinaconnect.com> on 2014/12/24 21:11:48 UTC

Issue invoking WS-Security Enabled .net service using cxf endpoint - org.apache.cxf.interceptor.Fault: No username available

I am trying to invoke a third party .net web service with ws-security and I
am getting the following exception inspite of configuring all the required
parameters in WSS4JOutInterceptor.  Been struggling with this issue for past
one week. Appreciate any help.

*org.apache.cxf.interceptor.Fault: No username available
	at
org.apache.cxf.ws.security.wss4j.policyhandlers.TransportBindingHandler.handleBinding(TransportBindingHandler.java:177)[cxf-rt-ws-security-3.0.2.jar:3.0.2]*
	at
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessageInternal(PolicyBasedWSS4JOutInterceptor.java:195)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
	at
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:114)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
	at
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:101)[cxf-rt-ws-security-3.0.2.jar:3.0.2]
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)[cxf-core-3.0.2.jar:3.0.2]
	at
org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)[cxf-core-3.0.2.jar:3.0.2]
	at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:416)[cxf-core-3.0.2.jar:3.0.2]
	at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:112)[camel-cxf-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:416)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:166)[camel-core-2.14.1.jar:2.14.1]
	at
org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:74)[camel-core-2.14.1.jar:2.14.1]
	at java.util.TimerThread.mainLoop(Timer.java:555)[:1.8.0_25]
	at java.util.TimerThread.run(Timer.java:505)[:1.8.0_25]

Below is my cxf end point configuration

*<cxf:cxfEndpoint id="telapoint"
		address="https://mycompany.com/APIv2/MyService"
wsdlURL="https://mycompany.com/APIv2/MyServices.svc?wsdl">
		<cxf:inInterceptors>
			<ref bean="loggingInInterceptor" />
		</cxf:inInterceptors>
		<cxf:outInterceptors>
			<ref bean="loggingOutInterceptor" />
			<ref bean="wss4jOutInterceptor" />
		</cxf:outInterceptors>
		<cxf:properties>
			<entry key="dataFormat" value="PAYLOAD" />
		</cxf:properties>
	</cxf:cxfEndpoint&lt;/b>>

/*<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="xxxxxx" />
				<entry key="passwordCallbackClass"
					value="com.atlasoil.integration.telapoint.UTPasswordCallback" />
				<entry key="addUsernameTokenNonce" value="true" />
				<entry key="addUsernameTokenCreated" value="true" />
			</map>
		</constructor-arg>
</bean>*/

Route
/	*<camelContext xmlns="http://camel.apache.org/schema/spring"
		trace="false">
		<route id="telaPoint_Camel_Route_with_CXF">
			<from uri="timer://foo?fixedRate=true&amp;period=10m" />
			
			<setBody>
				<constant>
                
				</constant>
			</setBody>
			<setHeader headerName="operationName">
				<constant>OrdersGetByStatus</constant>
			</setHeader>
			<setHeader headerName="operationNamespace">
				<constant>http://mycompany.com/TelaFuel/v2</constant>
			</setHeader>
			<to uri="telapoint" />
		</route>
	</camelContext>*/

Below are my POM depedencies

	<properties>
		<camel-version>2.14.1</camel-version>
		<log4j-version>1.2.17</log4j-version>
		<jaxb-api-version>2.2.12</jaxb-api-version>
		<jaxb-impl-version>2.2.11</jaxb-impl-version>
		<cxf-version>3.0.2</cxf-version>
		<log4j-version>1.2.17</log4j-version>
	</properties>


	<dependencies>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-core</artifactId>
			<version>${camel-version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-spring</artifactId>
			<version>${camel-version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-cxf</artifactId>
			<version>${camel-version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-http</artifactId>
			<version>${camel-version}</version>
		</dependency>
		
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxws</artifactId>
			<version>${cxf-version}</version>
		</dependency>

		
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http</artifactId>
			<version>${cxf-version}</version>
		</dependency>

		
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-ws-security</artifactId>
			<version>${cxf-version}</version>
		</dependency>
		
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j-version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.7.5</version>
		</dependency>

		
		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-transports-http-jetty</artifactId>
			<version>${cxf-version}</version>
		</dependency>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.cxf</groupId>
			<artifactId>cxf-rt-frontend-jaxrs</artifactId>
			<version>${cxf-version}</version>
		</dependency>

	</dependencies>

(below is the snippet of the ws-policy from the wsdl)

<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpToken/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy/>
</sp:Wss11>
<sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportIssuedTokens/>
<sp:RequireClientEntropy/>
<sp:RequireServerEntropy/>
</wsp:Policy>
</sp:Trust10>
</wsp:All>
</wsp:ExactlyOne>



--
View this message in context: http://camel.465427.n5.nabble.com/Issue-invoking-WS-Security-Enabled-net-service-using-cxf-endpoint-org-apache-cxf-interceptor-Fault-Ne-tp5761081.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Issue invoking WS-Security Enabled .net service using cxf endpoint - org.apache.cxf.interceptor.Fault: No username available

Posted by Colm O hEigeartaigh <co...@apache.org>.
You're mixing up two different ways of configuring WS-Security in CXF. When
you have a security policy, you don't need to add the WSS4JOutInterceptor
explicitly, CXF will take care of doing this for you. Instead you need to
supply some contextual properties to enable it to fulfil the policy. In
this case, you need to supply a value for "ws-security.username". See here
for more information:

http://cxf.apache.org/docs/ws-securitypolicy.html

Colm.

On Thu, Dec 25, 2014 at 9:24 AM, Naveen Vangipurapu <
nvangipurapu@infinaconnect.com> wrote:

> Can anybody help please?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Issue-invoking-WS-Security-Enabled-net-service-using-cxf-endpoint-org-apache-cxf-interceptor-Fault-Ne-tp5761081p5761096.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: Issue invoking WS-Security Enabled .net service using cxf endpoint - org.apache.cxf.interceptor.Fault: No username available

Posted by Naveen Vangipurapu <nv...@infinaconnect.com>.
Can anybody help please?



--
View this message in context: http://camel.465427.n5.nabble.com/Issue-invoking-WS-Security-Enabled-net-service-using-cxf-endpoint-org-apache-cxf-interceptor-Fault-Ne-tp5761081p5761096.html
Sent from the Camel - Users mailing list archive at Nabble.com.