Announcement Announcement Module
No announcement yet.
Handling fault message from ws:outbound gateway Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handling fault message from ws:outbound gateway


    I am calling a web service asynchronously (task executors), but I cannot figure out how to handle the soap fault messages by using SI.

    I want to catch the faults and wrap them so that the faults get treated like every other "hit" when they reach the aggregator that aggregates the results. Like so:

    request > ws-outbound gateway > catch fault and wrap > aggregator > result page (shows results and summary of errors)

    I have tried with a fault-message-resolver that wraps the error messages and sends them to the error queue, but I am unable to transfer headers like correlationId from the initial request. The aggregator needs the headers to be able to correlate properly.

    How can I intercept the faults and transfer the message headers from the initial request?

  • #2
    I have started on a solution where I extend the
    MarshallingWebServiceOutboundGateway and catch exceptions in the
    doHandle method. That way I can stop the exceptions from propagating
    back up to the caller and return a fault object instead. I think that the fault handling for the outbound web service gateway should be configurable. It is not always desirable that exceptions propagate back up to the caller.


    • #3
      Can you check if any issue already in JIRA for 2.0 matches this requirement, and if not create a new 'improvement' request?



      • #4 might cut it.

        By the way, I did not know that I could supply a task executor with an error handler, like so:

        <channel id="channel">
           <dispatcher task-executor="errorHandlingTaskExecutor"/>
        <beans:bean id="errorHandlingTaskExecutor">
           <beans:constructor-arg ref="someTaskExecutor"/>
           <beans:constructor-arg ref="someErrorHandler"/>
        Maybe I can get hold of the MessagingException there and use getFailedMessage() to avoid extending the gateway all together? My main objective is to avoid that an exception terminates the chain and stops messages from arriving at the aggregator. If an exception occurs it should be converted to a "normal" message and sent to the aggregator like every other message. That way the aggregator can release normally.


        • #5
          Hi again!

          I got it working with the errorHandlingTaskExecutor approach.