【发布时间】:2012-02-22 23:28:02
【问题描述】:
我正在使用 SoapHandler 为 Web 服务客户端记录 RequestXML,如下所示
public boolean handleMessage(SOAPMessageContext smc) {
logToSystemOut(smc);
return true;
}
private void logToSystemOut(SOAPMessageContext smc) {
Boolean outboundProperty = (Boolean)
smc.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (outboundProperty.booleanValue()) {
out.println("\nOutbound message:");
} else {
out.println("\nInbound message:");
}
SOAPMessage message = smc.getMessage();
try {
message.writeTo(out);
out.println("");
} catch (Exception e) {
out.println("Exception in handler: " + e);
}
}
获得了将此 xml 以及一些额外值(xml 中不存在)添加到 DB 的新要求。有什么办法可以将一些额外的字段传递给上面的肥皂处理程序(在 handleMessage 方法中)?
请注意,更改 xml/WSDL 或将其添加到 SOAP 消息标头对我来说不是一个选项,因为它归其他接口所有。还有其他解决方案吗?
谢谢!
【问题讨论】:
标签: web-services soap jax-ws