打印 SOAP 消息的 XML 内容
我正在使用 Apache CXF 作为我的网络服务。我创建了一个 AbstractSoapInterceptor 实例。在其 public void handleMessage(SoapMessage message) throws Fault
方法中,我想将截获消息的 XML 内容打印到控制台。我怎样才能做到这一点?
I am using Apache CXF for my webservices. I've created an instance of AbstractSoapInterceptor
. In its public void handleMessage(SoapMessage message) throws Fault
method I would like to print the XML content of the intercepted message to the console. How can I achieve that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查这个并搜索INBOUND INTERCEPTOR。放在这里供大家参考...
Check this out and search for INBOUND INTERCEPTOR. Will place it here for reference...
您有什么理由不能只使用 CXF 附带的
LoggingInInterceptor
吗?您可以直接获取该代码并将其用作基础,但在 2.3 中,LoggingInInterceptor 得到了增强,允许指定要使用的打印流等,因此它可能“正常工作”。Any reason you cannot just use the
LoggingInInterceptor
that is shipped with CXF? You could just grab the code for that and use that as a basis, but in 2.3, theLoggingInInterceptor
was enhanced to allow specifying a printstream and such to use, so it might "just work".您还可以使用以下功能:
org.apache.cxf.feature.LoggingFeature
:You can also use a feature for this:
org.apache.cxf.feature.LoggingFeature
: