Any workaround for ignoring unexpected elements in Apache Axis 1.4?

后端 未结 3 1316
北恋
北恋 2021-02-19 02:23

The problem was asked before \"Apache AXIS Ignore/Skip additional element while parsing\" in 2012 for Apache Axis 2. Is there no workaround yet for Axis 1.4?

Pro

3条回答
  •  甜味超标
    2021-02-19 02:34

    Not having used Axis 1.4, but after a quick glance at the docs.

    You can add a Handler to your code. You should be able even do this without having to recompile it, it that's an issue. A Handler wraps the underlying web service, it's called before the service is invoked, and after it returns. It's sorta like a Servlet Filter, but for Web Services.

    The Handler has full access to the SOAP body before it gets sent forward for processing. So you can use this as an opportunity to remove elements that you don't like.

    Dig a bit and you'll find you eventually get a DOM element that represents your SOAP body, so you can play primitive DOM games to add/delete nodes, etc. and set that back all within the Handler.

    Your service will never see the new nodes in the edit SOAP body.

    All that said, you may well be able to even do this using a Servlet Filter as well.

提交回复
热议问题