Re: None of the alternatives error while invoking service having policy with empty ExactlyOne

2016-09-19 Thread Akanksha Agrawal
On Fri, Sep 16, 2016 at 7:21 AM, Daniel Kulp  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:
>  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"/>
> 

Re: None of the alternatives error while invoking service having policy with empty ExactlyOne

2016-09-16 Thread Akanksha Agrawal
Thanks Daniel.

Here https://www.w3.org/Submission/WS-Policy/#Optional_Policy_Assertions

Section 4.3.3 says:

Empty
 expresses a policy with zero policy alternatives.
I think this means, this is a valid policy assertion.
Also, the web service which I am trying to invoke is getting invoked from
other SOAP Clients like SOAP UIand Boomerang but I am unable to invoke
using CXF Client. Thus getting error on the CXF client side itself.
The actual web service which I am trying to invoke is exposed by SAP and it
is not giving any error if I invoke it using other SOAP Clients like SOAP
UI or Boomerang.
This is the actual policy which is attached to the SAP web service:
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"/>

Re: None of the alternatives error while invoking service having policy with empty ExactlyOne

2016-09-16 Thread Daniel Kulp

According to the WS-Policy spec:

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  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
dk...@apache.org  - http://dankulp.com/blog 

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