Hi guys, I've having a problem and though I google it (a lot) I can't find the answer.
I'm getting the following exception when trying to hit a WS: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied. The Java client was created with CXF from a WSDL definition. The portion of the WSLD that seems to be causing the truble is: /************************************************************/ <wsp:UsingPolicy wsdl:required=3D"true" /> <wsp:Policy wsu:Id=3D"BN_BN_binding"> <saptrnbnd:OptimizedXMLTransfer uri=3D"http://xml.sap.com/2006/11/esi/esp/binxml" xmlns:saptrnbnd=3D" http://www.sap.com/webas/710/soap/features/transportbinding/" wsp:Optional=3D"true" /> <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd=3D" http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional=3D"true" /> <wsp:ExactlyOne xmlns:wsp=3D"http://schemas.xmlsoap.org/ws/2004/09/policy"> <wsp:All> <sp:TransportBinding xmlns:sp=3D"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp=3D"http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa=3D"http://www.w3.org/2005/08/addressing" xmlns:wst=3D" http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu=3D"http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx=3D"http://schemas.xmlsoap.org/ws/2004/09/mex"> xmlns:sp=3D"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp=3D"http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa=3D"http://www.w3.org/2005/08/addressing" xmlns:wst=3D" http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu=3D"http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx=3D"http://schemas.xmlsoap.org/ws/2004/09/mex"> xmlns:sp=3D"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:sapsp=3D"http://www.sap.com/webas/630/soap/features/security/policy" xmlns:wsa=3D"http://www.w3.org/2005/08/addressing" xmlns:wst=3D" http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:wsu=3D"http://schemas.xmlsoap.org/ws/2002/07/utility" xmlns:wsx=3D"http://schemas.xmlsoap.org/ws/2004/09/mex"> <wsp:Policy> <sp:TransportToken> <wsp:Policy> <sp:HttpsToken> <wsp:Policy> <sapsp:HTTPSSO2 /> </wsp:Policy> </sp:HttpsToken> </wsp:Policy> </sp:TransportToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:Basic128Rsa15 /> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict /> </wsp:Policy> </sp:Layout> </wsp:Policy> </sp:TransportBinding> </wsp:All> </wsp:ExactlyOne> <wsaw:UsingAddressing xmlns:wsaw=3D"http://www.w3.org/2006/05/addressing/ws= dl" wsp:Optional=3D"true" /> </wsp:Policy> /************************************************************/ This is what I've done from the Java side: CustomerBundleMaintainRequestMessageSyncV1 request =3D getRequestManageCustomer(); ManageCustomerIn servicePort =3D new Service().getBinding(); Client client =3D ClientProxy.getClient(servicePort); HTTPConduit http =3D (HTTPConduit) client.getConduit(); AuthorizationPolicy authPolicy =3D new AuthorizationPolicy(); authPolicy.setUserName("some_user"); authPolicy.setPassword("some_password"); authPolicy.setAuthorizationType("Basic"); http.setAuthorization(authPolicy); try { servicePort.checkMaintainBundleV1(request); } catch (StandardFaultMessage_Exception e) { e.printStackTrace(); } Thing is, it's failing in this particular line of the snippet: HTTPConduit http =3D (HTTPConduit) client.getConduit(); This is the full stack trace: Exception in thread "main" org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied. at org.apache.cxf.ws.policy.EndpointPolicyImpl.chooseAlternative( EndpointPolicyImpl.java:165) at org.apache.cxf.ws.policy.EndpointPolicyImpl.finalizeConfig( EndpointPolicyImpl.java:145) at org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize( EndpointPolicyImpl.java:141) at org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo( PolicyEngineImpl.java:549) at org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy( PolicyEngineImpl.java:295) at org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy( PolicyEngineImpl.java:278) at org.apache.cxf.ws.policy.PolicyDataEngineImpl.getClientEndpointPolicy( PolicyDataEngineImpl.java:61) at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy( HTTPConduit.java:319) at org.apache.cxf.transport.http.HTTPConduit.<init>(HTTPConduit.java:304) at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit( HTTPTransportFactory.java:250) at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit( SoapTransportFactory.java:228) at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit( SoapTransportFactory.java:235) at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit( AbstractConduitSelector.java:103) at org.apache.cxf.endpoint.UpfrontConduitSelector.selectConduit( UpfrontConduitSelector.java:77) at org.apache.cxf.endpoint.ClientImpl.getConduit(ClientImpl.java:842) at org.mule.sap.ondemand.core.Main.main(Main.java:100) I've try to register the policy handlers but looks like I'm not doing it right. Could you please give me a hand? Cheers, Damian. -- View this message in context: http://cxf.547215.n5.nabble.com/None-of-the-policy-alternatives-can-be-satisfied-Exception-tp5710035p5715585.html Sent from the cxf-user mailing list archive at Nabble.com.
