[ 
https://issues.apache.org/jira/browse/AXIS2-3668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12589651#action_12589651
 ] 

Misho Gradinkata commented on AXIS2-3668:
-----------------------------------------


Hi, all,

The same error is still present in axis2-RC4 !!

I took a look at the code and found the place it occurs -> in 
org.apache.axis2.jaxws.server.EndpointController#invoke(EndpointInvocationContext)
 :

        try {
            boolean good = handleRequest(eic);
/* -> here if an error occurs during the handler-chain execution, the chain is 
reverted from the broken handler to the back and close() is called on all 
invoked handlers */


            if (!good) { 
/* -> if the inbound handler-chain is not successful the service is not invoked 
- fine */
                return eic;
            }

/* here the service's business logic is executed */

        } catch (AxisFault af) {
            throw af;
        } catch (Exception e) {
            Throwable toBeThrown = InvocationHelper.determineMappedException(e, 
eic);
            if(toBeThrown == null) {
                toBeThrown = e;
            }
            throw ExceptionFactory.makeWebServiceException(toBeThrown);

        } finally {
/* -> finally-block is executed in case of an exception AND ALSO IN CASE OF 
return; WITHIN THE TRY-BLOCK */

            // Passed pivot point
            request.getMessage().setPostPivot();
            handleResponse(eic);
/* -> this one traverses all handlers again no matter that the handler-chain 
has already been reverted and closed, and at the end calls the @PreDestroy 
annotated methods */
        }



In my thoughts there should be some mechanism (a kind of a flag) for checking 
the case with the chain at some point before executing the outbound direction 
and jumping directly on the lifecycle @PreDestroy methods execution if needed. 
Or this method handleResponse() could be splited to pull out of it the 
@PreDestroy methods execution and drop only this part in the finally-block and 
the outbound traversal of the handlers to go into the try-block.
This is a design decision and could take time but I think this issue needs to 
be fixed for the axis2-1.4 release.

Thanks & Best regards,
Misho


> Wrong JAX-WS handler-chain execution
> ------------------------------------
>
>                 Key: AXIS2-3668
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3668
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: jaxws
>         Environment: Apache Tomcat 5.5.25
> Axis2-1.4/RC2
> soapUI for client
>            Reporter: Misho Gradinkata
>         Attachments: HelloServiceJAXWSAnnotated.aar, 
> my-jaxws-handler-chain.jar, request.xml
>
>
> Hi all,
> I'm testing Axis2-1.4/RC2 and its JAX-WS handler framework implementation. I 
> noticed some unconformities with the JAX-WS specification:
> I have a handler chain with Handler1, Handler2, Handler3 and Handler4. The 
> four of them have handleMessage(), handleFault() and close() methods as well 
> as init() and destroy() methods annotated with @PostConstruct and @PreDestroy 
> respectively. When a message arrives init() is executed on all handlers, then 
> on the inbound direction Handler3's handleMessage() method throws a 
> ProtocolException -> then the chain is reverted and handleFault() is invoked 
> on Handler2 and Handler1, then close() on Handler 1, 2 and 3. As far as I 
> understand from the JAX-WS 2.0 specification this is the expected behavior. 
> So here I expect all @PreDestroy methods to be executed and that's all for 
> the handler-chain. BUT instead I can see that an outbound execution starts 
> (with OUTBOUND_PROPERTY = true) and handleFault() is called (again) on all 
> four handlers from 4 to 1, then close() on all handlers (again) and at the 
> end destroy() on all handlers.
> I guess that somewhere you miss to check for errors on the inbound chain 
> execution and a complete outbound chain is executed no matter what happened 
> on the inbound direction. I think it is important to fix this.
> Thanks.
> Regards,
> Misho

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to