You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Thomas Hecker (JIRA)" <ji...@apache.org> on 2008/10/09 18:52:44 UTC

[jira] Created: (AXIS2-4077) Wrong wsa:Action returned in fault message when an operation declares multiple faults

Wrong wsa:Action returned in fault message when an operation declares multiple faults
-------------------------------------------------------------------------------------

                 Key: AXIS2-4077
                 URL: https://issues.apache.org/jira/browse/AXIS2-4077
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.4.1
            Reporter: Thomas Hecker


I just noticed that throwing a fault causes Axis to include the wrong wsa:Action (and also the soap action http header) in the SOAP response when the following conditions apply:

- Addressing module is engaged
- There are multiple faults declared for the service operation that was invoked
- The AxisFault that is passed by the generated MessageReceiver does not have a fault action set

When these conditions apply, the wsa:Action header may have the value of a different fault than the one in the fault detail element.

The problem appears to be in MessageContextBuild.java (line 285):

        String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null;

        if (faultAction == null) {
            AxisOperation op = processingContext.getAxisOperation();
            if (op != null && op.getFaultAction() != null) {
                // TODO: Should the op be able to pick a fault action based on the fault?
                faultAction = op.getFaultAction();
            } else { //If, for some reason there is no value set, should use a sensible action.
                faultAction = Final.WSA_SOAP_FAULT_ACTION;
            }
        }

The op.getFaultAction() will simply return the action of the first fault among those declared for the operation. I suggest you change the code to:

        String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null;

        if (faultAction == null) {
            AxisOperation op = processingContext.getAxisOperation();
            if (op != null && op.getFaultAction((String)processingContext.getProperty(org.apache.axis2.Constants.FAULT_NAME)) != null) {
                faultAction = op.getFaultAction((String)processingContext.getProperty(org.apache.axis2.Constants.FAULT_NAME));
            } else { //If, for some reason there is no value set, should use a sensible action.
                faultAction = Final.WSA_SOAP_FAULT_ACTION;
            }
        }




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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-4077) Wrong wsa:Action returned in fault message when an operation declares multiple faults

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

Brian DePradine updated AXIS2-4077:
-----------------------------------

    Component/s:     (was: kernel)
                 Addressing

> Wrong wsa:Action returned in fault message when an operation declares multiple faults
> -------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4077
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4077
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: Addressing
>    Affects Versions: 1.4.1
>            Reporter: Thomas Hecker
>
> I just noticed that throwing a fault causes Axis to include the wrong wsa:Action (and also the soap action http header) in the SOAP response when the following conditions apply:
> - Addressing module is engaged
> - There are multiple faults declared for the service operation that was invoked
> - The AxisFault that is passed by the generated MessageReceiver does not have a fault action set
> When these conditions apply, the wsa:Action header may have the value of a different fault than the one in the fault detail element.
> The problem appears to be in MessageContextBuild.java (line 285):
>         String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null;
>         if (faultAction == null) {
>             AxisOperation op = processingContext.getAxisOperation();
>             if (op != null && op.getFaultAction() != null) {
>                 // TODO: Should the op be able to pick a fault action based on the fault?
>                 faultAction = op.getFaultAction();
>             } else { //If, for some reason there is no value set, should use a sensible action.
>                 faultAction = Final.WSA_SOAP_FAULT_ACTION;
>             }
>         }
> The op.getFaultAction() will simply return the action of the first fault among those declared for the operation. I suggest you change the code to:
>         String faultAction = (e instanceof AxisFault) ? ((AxisFault)e).getFaultAction() : null;
>         if (faultAction == null) {
>             AxisOperation op = processingContext.getAxisOperation();
>             if (op != null && op.getFaultAction((String)processingContext.getProperty(org.apache.axis2.Constants.FAULT_NAME)) != null) {
>                 faultAction = op.getFaultAction((String)processingContext.getProperty(org.apache.axis2.Constants.FAULT_NAME));
>             } else { //If, for some reason there is no value set, should use a sensible action.
>                 faultAction = Final.WSA_SOAP_FAULT_ACTION;
>             }
>         }

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