Hi Damian,

>From looking at your WSDL, the problem appears to be that some of the
policies are not optional. Your binding policy "BN_BN_binding" looks ok,
but the policies referenced in the PortType (e.g. "IF_IF_ManageCustomerIn")
are not optional. As they are not standard policies, CXF cannot handle
them, and an exception is thrown.

Colm.

On Fri, Oct 5, 2012 at 9:27 AM, Andrei Shakirin <[email protected]>wrote:

> Hi Damian,
>
> Could you also provide your WSDL with the policies?
> It seems that you use custom policy assertions into WS-Policy ({
> http://www.sap.com/webas/710/soap/features/transportbinding/}OptimizedXMLTransfer,
> etc), but don't register appropriate AssertionBuilders and
> PolicyInterceptorProviders. As far as your custom assertions are not
> satisfied, CXF throws exceptions.
>
> You can look for details in http://cxf.apache.org/docs/ws-policy.html.
>
> Regards,
> Andrei.
>
> -----Original Message-----
> From: Damian Sima [mailto:[email protected]]
> Sent: Donnerstag, 4. Oktober 2012 17:57
> To: [email protected]
> Subject: WARNING: No assertion builder for type &
> javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can
> be satisfied.
>
> Hi guys,
>
> I've come across this issue and I'm not sure how to fix it.
>
>
> I've have this WSDL with some policies, I've created the client with
> wsdl2java and I try to execute the following code:
>
> ManageCustomerIn servicePort = new Service().getBinding();
>
> Client client = ClientProxy.getClient(servicePort);
>
> HTTPConduit http = (HTTPConduit) client.getConduit();
>
> AuthorizationPolicy authPolicy = 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();
> }
>
> And I got this log in the console
>
> Oct 3, 2012 5:42:03 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service {http://sap.com/xi/A1S/Global}service from WSDL:
>
> file:/Users/damiansima/Documents/workspace/SAPSalesOnDemandClient/src/main/resources/schema/ManageCustomerIn1.wsdl
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/webas/710/soap/features/transportbinding/}OptimizedXMLTransfer
> registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/webas/630/soap/features/session/}Session registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/webas/700/soap/features/CentralAdministration/}CentralAdministration
> registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/NW05/soap/features/commit/}enableCommit registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/NW05/soap/features/blocking/}enableBlocking registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/NW05/soap/features/transaction/}required registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/NW05/soap/features/wsrm/}enableWSRM registered.
> Oct 3, 2012 5:42:04 PM
> org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl
> handleNoRegisteredBuilder
> WARNING: No assertion builder for type {
> http://www.sap.com/710/soap/features/idempotency/}Idempotency registered.
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: None of
> the policy alternatives can be satisfied.
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
>         at $Proxy30.checkMaintainBundleV1(Unknown Source)
>         at org.mule.sap.ondemand.core.Main.main(Main.java:112)
> 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: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.prepare(UpfrontConduitSelector.java:63)
>         at
>
> org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:846)
>         at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:527)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)
>         at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)
>         at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:89)
>         at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
>         ... 2 more
>
> Here you can find the WSDL:
>
> http://cxf.547215.n5.nabble.com/None-of-the-policy-alternatives-can-be-satisfied-Exception-tt5710035.html#a5715640
>
>
> Now what I did to make this work was to remove from the WSDL all policies
> listed in the console under warning (the ones with no assertion filter).
>
> Thing is it shouldn't be that the way is it?
>
> Is there a way I can fix this, is this the normal behavior.
>
> Cheers, Damian.
> --
> Damián. > - )
>



-- 
Colm O hEigeartaigh

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

Reply via email to