我正在使用 Axis2 框架编写 Web 服务。该服务将充当 DMZ 中的代理。它实际上只是我们本地局域网中真实服务的中继。
该服务使用设置了 mustUnderstand 标志的 header 。但是由于代理服务相当简单,它无法理解这些 header ,它只是应该将请求中继到我们的局域网,在那里可以处理所有 header 。
问题是,Axis2 检查 header 并抛出错误,因为通常读取和理解 header 的模块不存在。
有没有办法将 Axis2 配置为忽略 mustUnderstand 标志?
或者,一种从代码中处理该问题的方法也会受到赞赏。
最佳答案
我们必须做类似的事情,所以这应该让您接近您想要的。
您需要的是一个org.apache.axis2.handlers.AbstractHandler
在 Invoke(MessageContext msgContext)
函数中,你可以这样做
SOAPHeader header = msgContext.getEnvelope().getHeader();
if( header != null )
{
Iterator<?> blocks = soapHeader.examineAllHeaderBlocks();
while( blocks.hasNext() )
{
SOAPHeaderBlock block = (SOAPHeaderBlock)blocks.next();
if( ... some check to see if this is one of your headers ... )
block.setProcessed();
}
}
关于java - Axis2:禁用 MustUnderstand header 检查,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4715027/