You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jennifer Ruttan <je...@indivica.com> on 2013/08/26 22:59:33 UTC

Disabling WS-SecurityPolicy Processing on Client?

Hi all,

I have a client I've built for a service that implements a WSDL file containing a WS-SecurityPolicy that CXF can't read because it's got errors. I don't have control over the WSDL file, but I know how to construct a message that can be read successfully by the service (I've done it with SoapUI and have built in and outinterceptors that perform the required signing and encryption/decryption). Is there a way to prevent the WS-SecurityPolicy logic from executing? The stack trace I've received is posted below for reference.

Thanks
Jen


java.lang.IllegalArgumentException: {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}UsernameToken is not a <wsp:Policy> element.
	at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:176)
	at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
	at org.apache.cxf.ws.security.policy.builders.SupportingTokensBuilder.build(SupportingTokensBuilder.java:80)
	at org.apache.cxf.ws.security.policy.builders.SupportingTokensBuilder.build(SupportingTokensBuilder.java:44)
	at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
	at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
	at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
	at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
	at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
	at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
	at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
	at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
	at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
	at org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver.resolveReference(LocalServiceModelReferenceResolver.java:53)
	at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveLocal(Wsdl11AttachmentPolicyProvider.java:292)
	at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveReference(Wsdl11AttachmentPolicyProvider.java:272)
	at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:220)
	at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:136)
	at org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedMessagePolicy(PolicyEngineImpl.java:444)
	at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialisePolicy(EffectivePolicyImpl.java:168)
	at org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:91)
	at org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy(PolicyEngineImpl.java:200)
	at org.apache.cxf.ws.policy.PolicyOutInterceptor.handle(PolicyOutInterceptor.java:98)
	at org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:44)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
	at com.sun.proxy.$Proxy33.list(Unknown Source)
	at ca.ontario.health.edt.EDTDelegate_EDTPort_Client.main(EDTDelegate_EDTPort_Client.java:166)

Re: Disabling WS-SecurityPolicy Processing on Client?

Posted by Jason Pell <ja...@pellcorp.com>.
Don't provide the ?wsdl as part of the address.  In my project I apply the
WS policies separately as part of an interceptor and that works by
providing an address only no wsdl. Are you using a generated java client
and jaxws:client in spring?
On 27/08/2013 7:00 AM, "Jennifer Ruttan" <je...@indivica.com> wrote:

> Hi all,
>
> I have a client I've built for a service that implements a WSDL file
> containing a WS-SecurityPolicy that CXF can't read because it's got errors.
> I don't have control over the WSDL file, but I know how to construct a
> message that can be read successfully by the service (I've done it with
> SoapUI and have built in and outinterceptors that perform the required
> signing and encryption/decryption). Is there a way to prevent the
> WS-SecurityPolicy logic from executing? The stack trace I've received is
> posted below for reference.
>
> Thanks
> Jen
>
>
> java.lang.IllegalArgumentException: {
> http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}UsernameToken is not
> a <wsp:Policy> element.
>         at
> org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:176)
>         at
> org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
>         at
> org.apache.cxf.ws.security.policy.builders.SupportingTokensBuilder.build(SupportingTokensBuilder.java:80)
>         at
> org.apache.cxf.ws.security.policy.builders.SupportingTokensBuilder.build(SupportingTokensBuilder.java:44)
>         at
> org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
>         at
> org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
>         at
> org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
>         at
> org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
>         at
> org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
>         at
> org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
>         at
> org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
>         at
> org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
>         at
> org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
>         at
> org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver.resolveReference(LocalServiceModelReferenceResolver.java:53)
>         at
> org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveLocal(Wsdl11AttachmentPolicyProvider.java:292)
>         at
> org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveReference(Wsdl11AttachmentPolicyProvider.java:272)
>         at
> org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:220)
>         at
> org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:136)
>         at
> org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedMessagePolicy(PolicyEngineImpl.java:444)
>         at
> org.apache.cxf.ws.policy.EffectivePolicyImpl.initialisePolicy(EffectivePolicyImpl.java:168)
>         at
> org.apache.cxf.ws.policy.EffectivePolicyImpl.initialise(EffectivePolicyImpl.java:91)
>         at
> org.apache.cxf.ws.policy.PolicyEngineImpl.getEffectiveClientRequestPolicy(PolicyEngineImpl.java:200)
>         at
> org.apache.cxf.ws.policy.PolicyOutInterceptor.handle(PolicyOutInterceptor.java:98)
>         at
> org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(AbstractPolicyInterceptor.java:44)
>         at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>         at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
>         at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133)
>         at com.sun.proxy.$Proxy33.list(Unknown Source)
>         at
> ca.ontario.health.edt.EDTDelegate_EDTPort_Client.main(EDTDelegate_EDTPort_Client.java:166)