Spring Web Services - Exception Skipping ExceptionResolver

前端 未结 8 992
别那么骄傲
别那么骄傲 2020-12-19 04:33

I have a SOAP service, the request and responses work as expected with good input, if I specify bad input for an XML element

in request body:

...
<         


        
8条回答
  •  悲哀的现实
    2020-12-19 05:11

    I've looked more closely at your question and I think that I know what's happening. You exception handler is not called because it is in the higher level in the soap processing. You see, WebServiceMessageReceiverHandlerAdapter tries to decode the incoming string to an XML before sending it to the marshaller to be processed. Since the XML is invalid the call fails. And since WebServiceMessageReceiverHandlerAdapter does not support an exception handler, it just rethrows the exception "SaajSoapMessageException".

    Now what you can do is create a new class that extends WebServiceMessageReceiverHandlerAdapter, but that also wraps handleConnection() in a try/catch that uses your exception handler when a exception is throw.


    By the way, when debugging this kind of problem my approach is to output both method name and line number in log4j. As well as downloading the Spring sources.

提交回复
热议问题