Hi,
Maybe I am not understanding how this option is supposed to work. I
see something strange with how this parameter is used and I would
appreciate if someone can clarify my doubt.
I have someone's WSDL that contains their proprietary policy
assertions (e.g., microsoft's policy assertion describing a decoupled
port). I would like to simply ignore these unknown assertions and use
the WSDL as it is to get the other properties extracted from it
because I could just configure the CXF bus explicitly for those
unknown assertions. And I don't want to maintain my own copy of the
WSDL by removing these assertions or adding the wsp:Optional="true"
attribute to those assertions.
However, when I have such a WSDL with unknown assertions, I am getting
the policy exception at:
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)
...
(using 2.5.0-SNAPSHOT.)
I thought this ignoreUnknownAssertions property could help me in this
case. Unfortunately, it didn't and a few things that I saw puzzled me.
1. This property is set in PolicyEngineImpl by the configuration and
it appears that it is supposed to be passed to
AssertionBuilderRegistryImpl where it is set to its local attribute.
In this registry impl class, this property is later used to throw or
not to throw an exception during assertion builder registration.
However, this attribute passing occurs at setBus() method of
PolicyEngineImpl at the beginning and not after
setIgnoreUnknownAssertions() is called. So, no matter how you set
this property in the configuration, AssertionBuilderRegistryImpl
always has this attribute set to its default value of true. This can
be verified in a simple test case where you get the instance of
AssertionBuilderRegistry from the bus and check its
IgnoreUnknownAssertion value.
2. AssertionBuilderRegistryImpl uses this attribute to decide whether
to thrown an exception in its handleNoRegisteredBuilder method.
However, this exception is ignored in the following
Wsdl11AttachmentPolicyProvider's try-catch block that calls that
method.
} catch (Exception policyEx) {
//ignore the policy can not be built
LOG.warning("Failed to build the policy '"
+ uri + "':" + policyEx.getMessage());
}
So, there seems to be no real effect in setting this property to false
or true to raise an exception.
The real exception comes from EndpointPolicyImpl's chooseAlternative
as shown earlier, as there is no alternative assertion for those
unknown assertions and they are not ignored during this check.
So, this thing confuses me. What is the intention of this
ignoreUnknownAssertion property? Is it for ignoring those unknown
assertions in such cases like I have? If so and it is not working as
intended, can I then correct this behavior? If it is not intended for
this purpose, can someone tell me what its intention is and if there
is a way to ignore those unknown assertions?
Thanks.
regards, aki