2

我有一个 SOAP 句柄类,我添加了一条语句来抛出自定义运行时异常(首先抛出 throw new IntrusionException,然后捕获它,然后抛出 MyRuntimeException)。

根据http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv_adv/handlers.html在“实现 Handler.handleMessage() 方法”部分,如果我在处理程序中抛出运行时异常,handleFault () 应该被调用。

我在我的应用程序中放置了断点,并且没有调用该方法。客户端不是肥皂故障,而是从 WS 获得通常的响应此外,由于某种原因,日志记录停止工作,并且在调试中不会在 WS 类断点处停止,但是一旦我将抛出异常语句取出再次,日志记录再次起作用。

public class GatewayRequestHandler implements javax.xml.ws.handler.soap.SOAPHandler<SOAPMessageContext> {

        // private static final Log LOG =
        // LogFactory.getLog(GatewayRequestHandler.class);
        private static final Logger LOG = ESAPI.getLogger(GatewayRequestHandler.class.getName());

        private static myEsapiValidator esapiValidator = (myEsapiValidator) ESAPI.validator();

        @Override
        public boolean handleMessage(SOAPMessageContext mc) {

                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                String outString = null;

                SOAPMessage soapMsg = mc.getMessage();
                try {
                        LOG.info(Logger.EVENT_UNSPECIFIED, "WSDL Operation: " + mc.get(MessageContext.WSDL_OPERATION));

                        soapMsg.writeTo(outStream);
                        outString = new String(outStream.toByteArray(), "UTF-8");

                        // validate inbound message

                        try {
                                outString = esapiValidator.getValidInput("ResponseDocument", outString, "my.XMLString",
                                        Integer.MAX_VALUE, true, true);
                                LOG.info(Logger.SECURITY_SUCCESS, "Successfully validated inbound message.");
                                throw new IntrusionException("Test canonicalization failure","test");
                        } catch (IntrusionException | ValidationException e) {
                                String errStr = "Error validating the inbound response message.";
                                LOG.error(Logger.SECURITY_FAILURE, errStr, e);
                                // throw new ComponentException(errStr, e);
                                throw new MyRuntimeException(errStr, e);
                        }

... @Override public boolean handleFault(SOAPMessageContext mc) {

4

0 回答 0