You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Fred Dushin (JIRA)" <ji...@apache.org> on 2008/10/08 12:11:44 UTC

[jira] Created: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
--------------------------------------------------------------------------------------

                 Key: CXF-1849
                 URL: https://issues.apache.org/jira/browse/CXF-1849
             Project: CXF
          Issue Type: Bug
          Components: WS-* Components
    Affects Versions: 2.1.2
            Reporter: Fred Dushin
             Fix For: 2.1.3, 2.2


When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.

So a response in this scenario will come out as follows:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
     <sayHiResponse xmlns="...">
       <responseType>Bonjou</responseType>
     </sayHiResponse>
     <soap:Fault>
       <faultcode>soap:Server</faultcode>
       <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
    </soap:Fault>
  </soap:Body>
</soap:Envelope>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Fred Dushin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fred Dushin updated CXF-1849:
-----------------------------

    Attachment: CXF-1849-trunk-r703513.patch

Proposed patch, per Dan's suggestion of logging in the case of an outbound server context.

This patch was generated off r703513 of trunk.

Please review inbound/outbound client/server logic detection, for soundness.  (full build from trunk passes with this change)

If all is well, I'd like to backmerge this patch to the 2.1.x-fixes branch.

Thanks!

> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>             Fix For: 2.1.3, 2.2
>
>         Attachments: CXF-1849-trunk-r703513.patch
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-1849:
--------------------------------

    Assignee: Daniel Kulp

> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>            Assignee: Daniel Kulp
>             Fix For: 2.1.3, 2.2
>
>         Attachments: CXF-1849-trunk-r703513.patch
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637897#action_12637897 ] 

Daniel Kulp commented on CXF-1849:
----------------------------------

I think policy verification on the outgoing side needs to just log an error, not throw an exception.  With streaming, there really isn't a way to "undo" what was written.

Either that, or all the policies need two interceptors.  One that runs very early to make sure the policy is assertable and then a second that really does the work.


> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>             Fix For: 2.1.3, 2.2
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang closed CXF-1849.
-----------------------------


> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>            Assignee: Daniel Kulp
>             Fix For: 2.1.3, 2.2
>
>         Attachments: CXF-1849-trunk-r703513.patch
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1849.
------------------------------

    Resolution: Fixed

> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>            Assignee: Daniel Kulp
>             Fix For: 2.1.3, 2.2
>
>         Attachments: CXF-1849-trunk-r703513.patch
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1849) PolicyVerificationOutInterceptor writes faults at wrong phase when processing response

Posted by "Fred Dushin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638626#action_12638626 ] 

Fred Dushin commented on CXF-1849:
----------------------------------

Thanks, Dan!

The merge back to the 2.1 fixes branch looks like it should be without conflict.  Should I submit a patch for that?  Or is there a different process for back-merging?

/work/src/apache/cxf/branches/2.1.x-fixes> svn diff -r 703557 rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java
===================================================================
--- rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java	(revision 703557)
+++ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java	(working copy)
@@ -63,32 +63,10 @@
         if (policy == null) {
             return;
         }
-
-        // CXF-1849 Log a message at FINE level if policy verification fails
-        // on the outbound-server side of a response
-        try {
-            aim.checkEffectivePolicy(policy.getPolicy());
-        } catch (final PolicyException e) {
-            if (isOutboundServer(message)) {
-                LOG.fine("An exception was thrown when verifying that the effective policy for "
-                         + "this request was satisfied.  However, this exception will not result in "
-                         + "a fault.  The exception raised is: "
-                         + e.toString());
-                return;
-            } else {
-                throw e;
-            }
-        }
+        
+        aim.checkEffectivePolicy(policy.getPolicy());
+        
         LOG.fine("Verified policies for outbound message.");
     }
-    
-    private boolean isOutboundServer(final Message message) {
-        final Object role = message.get(Message.REQUESTOR_ROLE);
-        final boolean isClient =
-            role != null ? Boolean.TRUE.equals(role) : false;
-        final boolean isOutbound =
-            message == message.getExchange().getOutMessage()
-            || message == message.getExchange().getOutFaultMessage();
-        return !isClient && isOutbound;
-    }
+
 }



> PolicyVerificationOutInterceptor writes faults at wrong phase when processing response
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-1849
>                 URL: https://issues.apache.org/jira/browse/CXF-1849
>             Project: CXF
>          Issue Type: Bug
>          Components: WS-* Components
>    Affects Versions: 2.1.2
>            Reporter: Fred Dushin
>            Assignee: Daniel Kulp
>             Fix For: 2.1.3, 2.2
>
>         Attachments: CXF-1849-trunk-r703513.patch
>
>
> When a CXF response is processed on an endpoint that contains policy assertions (via spring, WSDL, etc), and the policy assertions are not marked as asserted, the PolicyVerificationOutInterceptor properly raises a SOAP fault.  However, this interceptor is inserted into the "post-stream" phase, and it seems as though the fault gets written to the SOAP body after the business logic has been written.
> So a response in this scenario will come out as follows:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <sayHiResponse xmlns="...">
>        <responseType>Bonjou</responseType>
>      </sayHiResponse>
>      <soap:Fault>
>        <faultcode>soap:Server</faultcode>
>        <faultstring>These policy alternatives can not be satisfied: [snip]</faultstring >
>     </soap:Fault>
>   </soap:Body>
> </soap:Envelope>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.