<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
CXF Policy Engine
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/richard.opalka%40jboss.com">Richard Opalka</a> in <i>JBoss Web Services Development</i> - <a href="http://community.jboss.org/message/565071#565071">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi Folks,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>   I'll be little bit verbose about the setup because I don't know how much Sergey is familiar with our test framework.</p><p>   I just commited first JBWS-3134 related test case to the framework.</p><p>This test case allows U to reproduce the CXF Policy engine issue we've been discussing on IRC yesterday.</p><p>In order to reproduce the issue I suggest U to modify</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3134/AddrFeaturesViaAnn/JBWS3134TestCase.java</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>and comment out all test test methods except <strong>testVerifyAddrHeadersExistForRequiredEchoPort()</strong> one.</p><p>Then do mvn clean install of this modified framework to your local maven repository so it's picked up by CXF tests.</p><p>U will also need to configure JBossAS to be debuggable (just comment out one line in $JBOSS_HOME/bin/run.conf)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here are the breakpoints U should set up in your IDE:</p><p> * org.apache.cxf.ws.policy.EffectivePolicy</p><p>   - void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) // [1]</p><p> * org.apache.cxf.ws.Policy.PolicyEngineImpl</p><p>   - public synchronized AlternativeSelector getAlternativeSelector() // [2]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To run just this one test do:</p><p> * if executed first time</p><p>   - [../cxf/trunk]>mvn -Ptestsuite,spring,hudson,jboss601 test -Dtest=**/jaxws/jbws3134/**/*TestCase</p><p> * if executed not first time (to save some time)</p><p>   - [../cxf/trunk]>mvn -Ptestsuite,spring,hudson,jboss601 test -Dtest=**/jaxws/jbws3134/**/*TestCase -Dnoprepare</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>IDENTIFIED ISSUE</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I've been debugging this issue and here are my investigation results:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If I set wsp:Optional="false" in</p><p>cxf/trunk/modules/testsuite/framework-tests/target/test-libs/jaxws-jbws3134-addrfeaturesviaann-endpoint.war!/WEB-INF/wsdl/EchoService.wsdl</p><p>before running test then there's only one policy alternative associated with EchoImpl - addressing.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If I set wsp:Optional="true" in</p><p>cxf/trunk/modules/testsuite/framework-tests/target/test-libs/jaxws-jbws3134-addrfeaturesviaann-endpoint.war!/WEB-INF/wsdl/EchoService.wsdl</p><p>then there're two policy alternatives created and associated with EchoImpl - addressing & empty one.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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</p><p>if wsp:Optional="true" is specified in WSDL.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>SUGGESTED SOLUTIONS?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This is the question I wanna discuss with U <span> ;) </span></p><p>The problem that I see is PolicyAlternativeSelector is not taking incomming SOAP envelope content into account.</p><p>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.</p><p>I see there are three default AlternativeSelector implementations in CXF:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>[/home/opalka][/home/opalka/THIRDPARTY/CXF/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector]>ls -al | grep java<br/>FirstAlternativeSelector.java<br/>MaximalAlternativeSelector.java<br/>MinimalAlternativeSelector.java</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>But none of it is taking incoming SOAP envelope content into account thus sometimes picking up wrong policy alternative.</p><p>The question is what should do this SOAP envelope inspection. AlternativeSelector or PolicyEngine?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I see that org.apache.cxf.ws.policy.PolicyEngine have these methods:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> * EffectivePolicy getEffectiveServerRequestPolicy(EndpointInfo ei, BindingOperationInfo boi)</p><p> * EffectivePolicy getEffectiveServerResponsePolicy(EndpointInfo ei, BindingOperationInfo boi, Destination d);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Should these methods inspect incomming SOAP envelope and filter out effective policy alternatives before passing them to AlternativeSelector?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks in advance for your feedback.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/565071#565071">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>