On Fri, Sep 16, 2016 at 7:21 AM, Daniel Kulp <[email protected]> wrote: >
> > Just because other clients can work with invalid policies does not mean CXF > should. The ExactlyOne should be removed from that policy (or an All > added as a child). > Yes I agree that CXF should not work with invalid policy. But what I believe is the policy enforcement is done by the service provider and client has to send the request as enforced by the policy set by the service provider. So in my case, the service provider which is SAP does not throw any exception if I invoke the service through other clients which means according to SAP web service, the request sent by the client is valid. In case of CXF client, the request is not reaching the service and exception is being thrown at the client side itself. Should CXF check the policy validity on the client side? Also, it would be not be possible for me to change the policy in the service as the service provider is SAP, a third party application. So my question is, is there any way I can invoke the SAP web service using CXF? Thanks, Akanksha > > Dan > > > This is the actual policy which is attached to the SAP web service: > <wsp:Policy wsu:Id="BN_ZRPMATERIAL"><!-- Exactly One is empty here > --><wsp:ExactlyOne > xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sapsp=" > http://www.sap.com/webas/630/soap/features/security/policy"xmlns:sp=" > http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsa=" > http://www.w3.org/2005/08/addressing" xmlns:wsu=" > http://schemas.xmlsoap.org/ws/2002/07/utility"/> > <saptrnbnd:OptimizedXMLTransferxmlns:saptrnbnd=" > > http://www.sap.com/webas/710/soap/features/transportbinding/" uri=" > http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/> > </wsp:Policy> > If the service is getting invoked from other SOAP Clients, can we not > invoke it using CXF Client as well? > Please let me know if my understanding is wrong about this. > Thanks, > Akanksha > > On Fri, Sep 16, 2016 at 6:23 AM, Daniel Kulp <[email protected]> wrote: > > > According to the WS-Policy spec: > > http://specs.xmlsoap.org/ws/2004/09/policy/ws-policy.pdf < > > http://specs.xmlsoap.org/ws/2004/09/policy/ws-policy.pdf> > > > Section 4.1: > > /wsp:Policy/wsp:ExactlyOne A collection of policy alternatives. If there > > are no Element Information Items in the [children] property, there are no > admissible policy alternatives, i.e., no behavior is admissible. > > > Thus, I believe the current behavior is correct. > > > Dan > > > > On Sep 16, 2016, at 6:47 AM, Akanksha Agrawal <[email protected]> > > wrote: > > > Hello folks, > > I am trying to invoke a web service having the following policy attached: > > https://gist.github.com/Akanksha08/8acdeaf4467fc06c29a6d4f9f7f2a19d > > I am getting the following Exception: > > javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives > can be satisfied. > at org.apache.cxf.jaxws.DispatchImpl.mapException(DispatchImpl.java:290) > at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:334) > at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:246) > at com.ws.cxf.client.SOAPClient.invokeService(SOAPClient.java:71) > at com.ws.cxf.client.SOAPClient.main(SOAPClient.java:42) > Caused by: org.apache.cxf.ws.policy.PolicyException: None of the > policy alternatives can be satisfied. > at > > org.apache.cxf.ws.policy.EndpointPolicyImpl.chooseAlternative(EndpointPolicyImpl.java:166) > > 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:584) > > at > > org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:313) > > at > > org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:294) > > at > > org.apache.cxf.ws.policy.PolicyDataEngineImpl.getClientEndpointPolicy(PolicyDataEngineImpl.java:61) > > at > > org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:316) > > at > > org.apache.cxf.transport.http.HTTPConduit.getClient(HTTPConduit.java:850) > > at > > org.apache.cxf.transport.http.HTTPConduit.configureConduitFromEndpointInfo(HTTPConduit.java:347) > > at > > org.apache.cxf.transport.http.HTTPConduit.finalizeConfig(HTTPConduit.java:427) > > at > > org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:242) > > at > > org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:222) > > at > > org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:229) > > at > > org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:145) > > at > > org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:107) > > at > > org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63) > > at > > org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:849) > > at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:509) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279) > at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:314) > at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:327) > ... 3 more > > Could anyone please look into it? > > Thanks, > Akanksha > > > -- > Daniel Kulp > [email protected] <mailto:[email protected]> - http://dankulp.com/blog < > > http://dankulp.com/blog> > > Talend Community Coder - http://coders.talend.com < > > http://coders.talend.com/> > > > -- > Daniel Kulp > [email protected] - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com >
