Nandana,
I have been playing with this for a while. 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


Nandana Mihindukulasooriya wrote:
Mary,
Yes, I applied the patch [1] and resolved the issue and it is in the trunk. It seems we need to include some null checks in to the problematic operation.

thanks,
nandana

[1] - http://issues.apache.org/jira/browse/AXIS2-4114?page=com.atlassian.jira.plugin.ext.subversion:subversion-commits-tabpanel

On Mon, Nov 17, 2008 at 2:07 PM, Mary Thompson <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Nandana,
     I noticed that you resolved this jira as "fixed". Does this mean
    that something like Dobri's patch to MessageContext has been
    committed to axis trunk?

    The problem that I am having with no effective policy being found
    for fault message replies seemed similar enough that I wanted to try
    the fix if possible.

    I have my policy attached to operations. Successful replies find an
    effective policy and work just fine. If my application throws an
    axis fault due to wrong input from the client, no policy is found
    and the message is returned with no SOAP header.

    Having no clue as to how to "build against the axis2 SNAPSHOT" I
    downloaded the axis2-SNAPSHOT.jar of Nov 17, dumped it into the axis
    lib directory and went for it. After getting the axiom SNAPSHOT jars
    that were needed, I found that the successful case still worked, and
    the fault case got into trouble at

    2008-11-16 23:47:47,357 [ INFO]
    axis:org.apache.rampart.handler.RampartSender entering rampartSender
    invoke
    2008-11-16 23:47:47,357 [ INFO]
    axis:org.apache.rampart.handler.RampartSender Rampart is engaged
    2008-11-16 23:47:47,358 [ INFO]
    axis:org.apache.rampart.MessageBuilder Entering rampartMessageBuilder
    2008-11-16 23:47:47,359 [DEBUG]
    axis:org.apache.rampart.RampartMessageData RMD: creating
    RampartMessageData
    2008-11-16 23:47:47,427 [DEBUG]
    axis:org.apache.rampart.RampartMessageData RMD: trying effective Policy

    2008-11-16 23:47:47,429 [ERROR]
    
axis:org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/axis2].[AxisServlet]
    Servlet.service() for servlet AxisServlet threw exception
    java.lang.NullPointerException
           at
    
org.apache.axis2.context.MessageContext.findBindingMessage(MessageContext.java:1603)
           at
    
org.apache.axis2.context.MessageContext.getEffectivePolicy(MessageContext.java:1581)
           at
    org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:251)
           at
    org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61)
           at
    org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:66)
           at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
           at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:248)
           at
    org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:504)
           at
    
org.apache.axis2.transport.http.AxisServlet.handleFault(AxisServlet.java:416)
           at
    
org.apache.axis2.transport.http.AxisServlet.processAxisFault(AxisServlet.java:379)
           at
    org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:167)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
           at
    
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
           at
    
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
           at
    
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at
    
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
           at
    
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at
    
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
           at
    
org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:482)
           at
    
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
           at
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
           at
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
           at
    
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         at
    
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
           at
    
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
           at
    
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
           at java.lang.Thread.run(Thread.java:613)


    So I have a couple of questions:
     Is the fix for this jira in the Axis2-SNAPSHOT.jar?
     What is the correct way to use the Axis2-SNAPSHOT.jar? (I know that
    what I did gives me two versions of many classes which is usually a
    BAD THING)

    Thanks for any suggestions.

    Mary Thompson

    ---------------------------------------------------------------------
    Mary R. Thompson                                <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>
Lawrence Berkeley National Lab http://acs.lbl.gov/~mrt <http://acs.lbl.gov/%7Emrt>
    ----------------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to