在会话中存储 Axis 原始 XML 请求/响应(在 JSP 中使用)
如果可能的话,如何获取 Axis 在我的应用程序中调用/检索的原始 XML 请求/响应?
我使用 Axis 附带的 WSDL2Java 来生成 Java 存根。
编辑:
我目前拥有的是一个使用 Axis 处理远程 API 调用的应用程序。
要求之一是将来自这些调用的所有 XML 请求/响应“存储”在会话中,以便其在 JSP 中可用(用于调试目的)。我怎样才能实现这个目标?
我尝试编写一个扩展 BasicHandler 的自定义处理程序,但在该处理程序中,我仍然无法从 HttpServletRequest
/HttpServletResponse
对中获取>消息上下文
How, if possible, do I get the raw XML request/response that is invoked/retrieved by Axis in my application?
I'm using WSDL2Java that is included with Axis to generate the Java stubs.
EDIT:
What I currently have is an app that uses Axis to handle the remote API calls.
One of the requirement is to 'store' all the XML request/response from these calls in the session so that it will be available in the JSP (for debugging purposes). How can I achieve this?
I tried writing a custom handler that extends BasicHandler
but in that handler, I still can't get the HttpServletRequest
/HttpServletResponse
pair from the MessageContext
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过一段时间的搜索,它就像这样简单:
//After your _call.invoke(...);
其中 _call 是 org.apache.axis.client.Call
然后您可以将其保存在您想要的文件中...
After a while searching its as simple as this:
//After your _call.invoke(...);
where _call is org.apache.axis.client.Call
Then you can save it in a file where you want...
为什么不编写一个服务器端肥皂处理程序,获取 MessageContext,我相信有一种方法可以从那里获取有效负载。如果你想将它传递到下游,那么将它放在线程本地。请参阅处理程序的示例此处
Why don't you write a server side soap handler, get hold of MessageContext and I believe there is a way to get hold of the payload from there. If you want to pass it to downstream then put it in thread local. See e.g. of handler here
我最终使用了问题中描述的解决方案 。
基本上,我用它来获取 HttpServletRequest 并从那里我在会话中设置正确的项目
I end up using the solution described in this question
Basically, I use it to get a hold of the HttpServletRequest and from there I set the proper item in the session.