Richard Opalka [
http://community.jboss.org/people/richard.opalka%40jboss.com] created the
discussion
"CXF Policy Engine"
To view the discussion, visit:
http://community.jboss.org/message/565071#565071
--------------------------------------------------------------
Hi Folks,
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
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3134/AddrFeaturesViaAnn/JBWS3134TestCase.java
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:
* org.apache.cxf.ws.policy.EffectivePolicy
- void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) // [1]
* org.apache.cxf.ws.Policy.PolicyEngineImpl
- public synchronized AlternativeSelector getAlternativeSelector() // [2]
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
IDENTIFIED ISSUE
I've been debugging this issue and here are my investigation results:
If I set wsp:Optional="false" in
cxf/trunk/modules/testsuite/framework-tests/target/test-libs/jaxws-jbws3134-addrfeaturesviaann-endpoint.war!/WEB-INF/wsdl/EchoService.wsdl
before running test then there's only one policy alternative associated with EchoImpl
- addressing.
If I set wsp:Optional="true" in
cxf/trunk/modules/testsuite/framework-tests/target/test-libs/jaxws-jbws3134-addrfeaturesviaann-endpoint.war!/WEB-INF/wsdl/EchoService.wsdl
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 [2] 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.
SUGGESTED SOLUTIONS?
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
FirstAlternativeSelector.java
MaximalAlternativeSelector.java
MinimalAlternativeSelector.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.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/565071#565071]
Start a new discussion in JBoss Web Services Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]