I'll be little bit verbose about the setup because I don't know how much Sergey is familiar with our test framework.
I just commited first JBWS-3134 related test case to the framework.
This test case allows U to reproduce the CXF Policy engine issue we've been discussing on IRC yesterday.
In order to reproduce the issue I suggest U to modify
and comment out all test test methods except testVerifyAddrHeadersExistForRequiredEchoPort() one.
Then do mvn clean install of this modified framework to your local maven repository so it's picked up by CXF tests.
U will also need to configure JBossAS to be debuggable (just comment out one line in $JBOSS_HOME/bin/run.conf)
Here are the breakpoints U should set up in your IDE:
- void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) // 
- public synchronized AlternativeSelector getAlternativeSelector() // 
To run just this one test do:
* if executed first time
- [../cxf/trunk]>mvn -Ptestsuite,spring,hudson,jboss601 test -Dtest=**/jaxws/jbws3134/**/*TestCase
* if executed not first time (to save some time)
- [../cxf/trunk]>mvn -Ptestsuite,spring,hudson,jboss601 test -Dtest=**/jaxws/jbws3134/**/*TestCase -Dnoprepare
I've been debugging this issue and here are my investigation results:
If I set wsp:Optional="false" in
before running test then there's only one policy alternative associated with EchoImpl - addressing.
If I set wsp:Optional="true" in
then there're two policy alternatives created and associated with EchoImpl - addressing & empty one.
With PolicyEngineImpl used on endpoint side there's no policy AlternativeSelector configured so MinimalAlternativeSelector is instantiated and used (see  breakpoint in your IDE). This org.apache.cxf.ws.policy.selector.MinimalAlternativeSelector simply picks up empty assertion
if wsp:Optional="true" is specified in WSDL.
This is the question I wanna discuss with U
The problem that I see is PolicyAlternativeSelector is not taking incomming SOAP envelope content into account.
This said if some policy is optional, CXF should be able to somehow inspect incoming SOAP envelopes and pick up proper policy alternative for it.
I see there are three default AlternativeSelector implementations in CXF:
[/home/opalka][/home/opalka/THIRDPARTY/CXF/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector]>ls -al | grep java
But none of it is taking incoming SOAP envelope content into account thus sometimes picking up wrong policy alternative.
The question is what should do this SOAP envelope inspection. AlternativeSelector or PolicyEngine?
I see that org.apache.cxf.ws.policy.PolicyEngine have these methods:
* EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi)
* EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, Destination d);
Should these methods inspect incomming SOAP envelope and filter out effective policy alternatives before passing them to AlternativeSelector?
Thanks in advance for your feedback.