Forgot to attach the exception trace
Regards,
Renu
-----Original Message-----
From: Gupta, Renu
Sent: Wednesday, February 12, 2014 7:06 PM
To: Mishra, Praveen; [email protected]; [email protected]
Subject: Issue with STS using Dispatch API
Hi,
Could you please help us with the below mail. We are trying to evaluate STS
with CXF and facing problem. I have used the same server given in CXF sample.
Please find the attached code.
We are revamping our entire stack to use CXF and this issue is hindering us
from implementing WS-Trust with CXF, one of the important features for clients.
Thanks,
Renu
-----Original Message-----
From: Mishra, Praveen
Sent: Tuesday, February 11, 2014 11:01 PM
To: [email protected]; [email protected]
Cc: Gupta, Renu
Subject: FW: WELCOME to [email protected]
Hi,
We are using STS sample to evaluate how we can use the dispatch API to achieve
WS-trust support in CXF and facing problem in setting the effective policy.
The stsclient properties and request context properties as follows:
Policy wsaPolicy = PolicyHelper.parsePolicy(client, "/wsa-policy.xml");
dispatch.getRequestContext().put(CLIENT_ADDRESSING_PROPERTIES,createMaps());
dispatch.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE, wsaPolicy);
Map<String,Object> stsmap = setSTSMaps();
client.getRequestContext().putAll(stsmap);
STSClient sts = new STSClient(client.getBus()); sts.setServiceQName(new
QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/","SecurityTokenService"));
sts.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}UT_Port");
client.getRequestContext().put("ws-security.sts.client", sts ); Map<String,
Object> stsprop = new HashMap<String, Object>() ;
stsprop.put("ws-security.username","alice");
stsprop.put("ws-security.callback-handler","ClientCallbackHandler");
stsprop.put("ws-security.encryption.properties","clientKeystore.properties");
stsprop.put("ws-security.encryption.username","mystskey");
stsprop.put("ws-security.sts.token.username","myclientkey");
stsprop.put("ws-security.sts.token.properties","clientKeystore.properties");
stsprop.put("ws-security.sts.token.usecert","true");
sts.getProperties().putAll(stsprop);
We are trying to evaluate the Apache CXf STS Sample comes with Sample examples.
We are trying to setup Dynamically through properties.
Please let us know what are the required properties needs to be set. Or if we
are missing anything above.
Thanks,
Praveen
Feb 12, 2014 7:11:30 PM
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://www.w3.org/2009/09/ws-mex}MetadataExchangeService from class
org.apache.cxf.ws.mex.MetadataExchange
Feb 12, 2014 7:11:32 PM org.apache.cxf.ws.addressing.soap.MAPCodec
restoreExchange
WARNING: Response message does not contain WS-Addressing properties. Not
correlating response.
Feb 12, 2014 7:11:32 PM org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing Properties from
context
Feb 12, 2014 7:11:32 PM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
WARNING: Interceptor for
{http://www.w3.org/2009/09/ws-mex}MetadataExchangeService#{http://www.w3.org/2009/09/ws-mex}Get2004
has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: A required header representing a Message
Addressing Property is not present
at
org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl.mediate(MAPAggregatorImpl.java:560)
at
org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl.handleMessage(MAPAggregatorImpl.java:142)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1625)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1516)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1323)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
at $Proxy56.get2004(Unknown Source)
at
org.apache.cxf.ws.security.trust.AbstractSTSClient.configureViaEPR(AbstractSTSClient.java:513)
at
org.apache.cxf.ws.security.trust.STSUtils.getClient(STSUtils.java:122)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.issueToken(IssuedTokenInterceptorProvider.java:428)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.handleMessage(IssuedTokenInterceptorProvider.java:130)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:302)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:381)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:243)
at TestCXFSTS.testService1(TestCXFSTS.java:105)
at TestCXFSTS.main(TestCXFSTS.java:49)
javax.xml.ws.soap.SOAPFaultException: A required header representing a Message
Addressing Property is not present
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:159)
at $Proxy56.get2004(Unknown Source)
at
org.apache.cxf.ws.security.trust.AbstractSTSClient.configureViaEPR(AbstractSTSClient.java:513)
at
org.apache.cxf.ws.security.trust.STSUtils.getClient(STSUtils.java:122)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.issueToken(IssuedTokenInterceptorProvider.java:428)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.handleMessage(IssuedTokenInterceptorProvider.java:130)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:302)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:381)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:243)
at TestCXFSTS.testService1(TestCXFSTS.java:105)
at TestCXFSTS.main(TestCXFSTS.java:49)
Caused by: org.apache.cxf.binding.soap.SoapFault: A required header
representing a Message Addressing Property is not present
at
org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl.mediate(MAPAggregatorImpl.java:560)
at
org.apache.cxf.ws.addressing.impl.MAPAggregatorImpl.handleMessage(MAPAggregatorImpl.java:142)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1625)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1516)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1323)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
... 15 more
Feb 12, 2014 7:11:32 PM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
WARNING: Interceptor for #{http://cxf.apache.org/jaxws/dispatch}Invoke has
thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: A required header representing a Message
Addressing Property is not present
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1625)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1516)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1323)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at
org.apache.cxf.ws.security.trust.AbstractSTSClient.issue(AbstractSTSClient.java:788)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:62)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:56)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:52)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.getTokenFromSTS(IssuedTokenInterceptorProvider.java:359)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.issueToken(IssuedTokenInterceptorProvider.java:468)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.handleMessage(IssuedTokenInterceptorProvider.java:130)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:302)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:381)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:243)
at TestCXFSTS.testService1(TestCXFSTS.java:105)
at TestCXFSTS.main(TestCXFSTS.java:49)
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: A required
header representing a Message Addressing Property is not present
at org.apache.cxf.jaxws.DispatchImpl.mapException(DispatchImpl.java:287)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:388)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:243)
at TestCXFSTS.testService1(TestCXFSTS.java:105)
at TestCXFSTS.main(TestCXFSTS.java:49)
Caused by: org.apache.cxf.binding.soap.SoapFault: A required header
representing a Message Addressing Property is not present
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:84)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:51)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:40)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:113)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1625)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1516)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1323)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at
org.apache.cxf.ws.security.trust.AbstractSTSClient.issue(AbstractSTSClient.java:788)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:62)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:56)
at
org.apache.cxf.ws.security.trust.STSClient.requestSecurityToken(STSClient.java:52)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.getTokenFromSTS(IssuedTokenInterceptorProvider.java:359)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.issueToken(IssuedTokenInterceptorProvider.java:468)
at
org.apache.cxf.ws.security.policy.interceptors.IssuedTokenInterceptorProvider$IssuedTokenOutInterceptor.handleMessage(IssuedTokenInterceptorProvider.java:130)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:302)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:381)
... 3 more