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 "Dobri Kitipov (JIRA)" <ji...@apache.org> on 2008/10/31 15:41:44 UTC

[jira] Created: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-4114
                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
            Reporter: Dobri Kitipov


Hi,
I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:

<parameter name="useOriginalwsdl">true</parameter>

and a PolicyAttachment at its service level:

<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
            <wsp:AppliesTo>
                <policy-subject identifier="binding:soap11"/>
                <policy-subject identifier="binding:soap12"/>
            </wsp:AppliesTo>
            <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
</wsp:PolicyAttachment>

As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:

<wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsp:PolicyReference URI="#User"/>

At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:

Policy policy = msgCtx.getEffectivePolicy();

The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.

         AxisBindingMessage bindingMessage =
             (AxisBindingMessage)
 getProperty(Constants.AXIS_BINDING_MESSAGE);

         if (bindingMessage != null) {
             return bindingMessage.getEffectivePolicy();
         } else {
             if (axisMessage != null) {
                 return axisMessage.getEffectivePolicy();
             } else {
                 return null;
             }
         }

where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
You can see the patch applied that I have tested and seem to me that works fine.


Thank you in advance,
Dobri

-- 
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] Resolved: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Nandana Mihindukulasooriya resolved AXIS2-4114.
-----------------------------------------------

    Resolution: Fixed

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

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


[jira] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Nandana Mihindukulasooriya (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655239#action_12655239 ] 

Nandana Mihindukulasooriya commented on AXIS2-4114:
---------------------------------------------------

Hi Detelin, 
        I debugged this issue in the Rampart build and it is not the AxisOperation which is null but the bindingOperation. But your point is right, I think this dispatched using body based dispatching as actions are obviously different. Fixed the findBindingMessage not to cause NPE. 

thanks,
nandana

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

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


[jira] Reopened: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Andreas Veithen reopened AXIS2-4114:
------------------------------------


As pointed out by Mary Thompson in a comment above, there is still one case that has not been addressed: In the case where the service throws a fault there is no axisMessage in the message context. Since MessageContext#findBindingMessage doesn't test if axisMessage is null, there will be a NullPointerException in that case.

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

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


[jira] Resolved: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Nandana Mihindukulasooriya resolved AXIS2-4114.
-----------------------------------------------

    Resolution: Fixed

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650210#action_12650210 ] 

Detelin Yordanov commented on AXIS2-4114:
-----------------------------------------

Hi guys,
  It happens that in some cases the "axisOperation" field in the MessageContext is null, which causes a NPE in getApplicablePolicy() when trying to get the operation's name. 
This occurred by me when trying to execute the "RahasSAMLTokenV1205Test" test case from the rampart-integration module.
I examined it and found out that the request dispatcher could identify the service (SecureService in this case), but could not identify the operation to execute (issue). 
The problem seems to be that the action mapping of the Rahas module for the Issue operation is:
http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue (see rahas module.xml)
while the action set on the client is:
http://docs.oasis-open.org/ws-sx/ws-trust/200512 (see RahasSAMLTokenV1205Test#getRequestAction())

Since these are obviously different, the SOAPActionBasedDispatcher does not find the operation to invoke and thus the MC's axisOperation remains null. It is interesting that without this patch the test case runs successfully.

Nandana, do you have an idea why this happens?

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Nandana Mihindukulasooriya (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654760#action_12654760 ] 

Nandana Mihindukulasooriya commented on AXIS2-4114:
---------------------------------------------------

Hi Detelin, 
         Yes, exactly. If message level / operation level security to work the message has to be dispatched to correct operation in the pre dispatch phase. So either it should have SOAP Action or have addressing information. In Axis2, i don't see any work around. So I think we should better document this in Rampart site or the FAQ wiki [1]. 

thanks,
nandana

[1] - http://wiki.apache.org/ws/FrontPage/Rampart/FAQ

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Mary Thompson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650889#action_12650889 ] 

Mary Thompson commented on AXIS2-4114:
--------------------------------------

There is still another case of NPE
In the case where the service throws a fault there is no axisMessage in the msgCtx when we get to axis2/context/MessageContext. One can use the FLOW variable to figure out if it is an in or out message. The following patch works for me for both fault and non-fault cases, policy is attached at the operations.

diff MessageContext.orig MessageContext.fixed
1603c1603,1608
<        String direction = axisMessage.getDirection();
---
>        String direction = null;
>        if ((FLOW == IN_FLOW) || (FLOW == IN_FAULT_FLOW)) {
>             direction = WSDLConstants.MESSAGE_LABEL_IN_VALUE;
>        } else if ((FLOW == OUT_FLOW) || (FLOW == OUT_FAULT_FLOW)){
>             direction = WSDLConstants.MESSAGE_LABEL_OUT_VALUE;
>        }
1605c1610
<        if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN
---
>        if (WSDLConstants.MESSAGE_LABEL_IN_VALUE
1614c1619
<        } else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT
---
>        } else if (WSDLConstants.MESSAGE_LABEL_OUT_VALUE


I  noticed that in normal OUT_FLOW execution goes through WSDoAllSender before going into RampartSender, but in the OUT_FAULT_FLOW case it just goes to RampartSender. I don't know if WSDoAllSender would have created the axis message

Mary Thompson

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Dobri Kitipov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12646835#action_12646835 ] 

Dobri Kitipov commented on AXIS2-4114:
--------------------------------------

Hi,
I suppose that this JIRA should be closed? 

Regards,
Dobri

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Assigned: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Nandana Mihindukulasooriya reassigned AXIS2-4114:
-------------------------------------------------

    Assignee: Nandana Mihindukulasooriya

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Reopened: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Nandana Mihindukulasooriya reopened AXIS2-4114:
-----------------------------------------------


NPE is thrown in the case of axisOperation is null

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Glen Daniels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738176#action_12738176 ] 

Glen Daniels commented on AXIS2-4114:
-------------------------------------

Hi all - I just checked in NPE protection code (similar to Mary's patch) on the 1.5 branch.  I'm hesitant to mark this fixed until we have a test case... would anyone be willing to put a small one together?

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

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


[jira] Commented: (AXIS2-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650968#action_12650968 ] 

Detelin Yordanov commented on AXIS2-4114:
-----------------------------------------

Hi guys,
  It seems we have a chicken-and-egg problem here - we need to obtain the name of the operation to invoke so that we get the binding operation and binding message policies and compute the effective policy.

However, the operation to invoke could be populated in the Transport phase (before Security) only if it is identified by means of a SOAP Action, request URI and/or Addressing info in the request, but if such info is not available, these dispatchers won't be able to identify the operation and populate it in the message context.

After the Transport phase, Rampart will be invoked and it will request the effective policy but won't be able to get the binding-level policies if the operation is not identified.
After Security, in the Dispatch phase, the operation is normally identified from the SOAP message body, but this cannot be done before the Security phase since the body might be encrypted and the operation not visible.
So it seems that if we want to support the binding operation & binding operation message level security policies, we will have to instruct the client to use Soap Action/ Request URI or addressing so that we can identify the operation before Rampart.

Are these assumptions correct or there is some workaround we can use here?

Regards,
   Detelin


> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>            Assignee: Nandana Mihindukulasooriya
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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-4114) Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level

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

Dobri Kitipov updated AXIS2-4114:
---------------------------------

    Attachment: MessageContext_effectivePolicy.patch

My fix of the problem. I am not sure that we should have to keep the following check into the public Policy getEffectivePolicy() method:

if (axisMessage != null) {
        		return axisMessage.getEffectivePolicy();        		
        	} else {
        		return null;
        	}

> Problem to retrieve the effective policy from MessageContext when we have policy attachment at binding level
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4114
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4114
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Dobri Kitipov
>         Attachments: MessageContext_effectivePolicy.patch
>
>
> Hi,
> I have a problem when I try to get the effective policy from a MessageContext when I have a policy attached at the binding level of a Web Service. I am using Axis2 1.4.0
> Let me explain a little bit the scenario I have. I am using an AAR that has into its services.xml:
> <parameter name="useOriginalwsdl">true</parameter>
> and a PolicyAttachment at its service level:
> <wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>             <wsp:AppliesTo>
>                 <policy-subject identifier="binding:soap11"/>
>                 <policy-subject identifier="binding:soap12"/>
>             </wsp:AppliesTo>
>             <wsp:Policy wsu:Id="User" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">...
> </wsp:PolicyAttachment>
> As a result the WSDL generated has the policy specified and policy reference at the binding subject level. Here is an excerpt from the wsdl for the SOAP11Binding:
> <wsdl:binding name="MTOMServiceSOAP11Binding" type="tns:MTOMServicePortType">
> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsp:PolicyReference URI="#User"/>
> At client side I have a dynamic client. So the issue is that when I invoke the service and the WSDL is read and the corresponding AxisService object is crated at the client side I have some modules' handlers that take palce. One of them is a custom one in which I have the following invocation:
> Policy policy = msgCtx.getEffectivePolicy();
> The problem is that this returns "null"! I debugged this and it came out that msgCtx is not null. When the method is invoked it tries to calculate the effective policy as given below.
>          AxisBindingMessage bindingMessage =
>              (AxisBindingMessage)
>  getProperty(Constants.AXIS_BINDING_MESSAGE);
>          if (bindingMessage != null) {
>              return bindingMessage.getEffectivePolicy();
>          } else {
>              if (axisMessage != null) {
>                  return axisMessage.getEffectivePolicy();
>              } else {
>                  return null;
>              }
>          }
> where bindingMessage  is null and axisMessage.getEffectivePolicy(); returns null, too. When I dig through the AxisService -> AxisEndpoint -> AxisBinding -> here the PolicySubject is in fact a PolicyReference to the Policy that is set into the AxisService policyMap. So as a result axisMessage.getEffectivePolicy() returns null and I can not get the Policy I need.
> I saw that I need something like the AxisDescription.getApplicablePolicy in order to locate the real Policy of a given PolicyReference.
> You can see the patch applied that I have tested and seem to me that works fine.
> Thank you in advance,
> Dobri

-- 
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