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

  • Handling fault message from ws:outbound gateway

    Hi,

    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.

    Comment


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

      Thanks,
      Mark

      Comment


      • #4
        http://jira.springframework.org/browse/INT-907 might cut it.

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

        Code:
        <channel id="channel">
           <dispatcher task-executor="errorHandlingTaskExecutor"/>
        </channel>
        
        <beans:bean id="errorHandlingTaskExecutor">
           <beans:constructor-arg ref="someTaskExecutor"/>
           <beans:constructor-arg ref="someErrorHandler"/>
        </beans:bean>
        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.

        Comment


        • #5
          Hi again!

          I got it working with the errorHandlingTaskExecutor approach.

          Comment

          Working...
          X