Java – store axis raw XML request / response in the session (to be used in JSP)

If possible, how do I get the original XML request / response that Axis called / retrieved in my application?

I am using wsdl2java supplied with axis to generate Java stubs

Edit:

What I currently have is an application that uses axis to handle remote API calls

One requirement is to "store" all XML requests / responses from these calls in the session so that it is available in JSP (for debugging purposes) How can I do this?

I try to write a custom handler that extends basichandler, but in this handler, I still can't get the HttpServletRequest / httpservletresponse pair from messagecontext

Solution

After searching for it over time, it's as simple as this:

//In_ call. After invoke (...);

//Request
String request = _call.getMessageContext().getRequestMessage().getSOAPPart().getEnvelope().getBody().toString();

//Response
String response = _call.getMessageContext().getResponseMessage().getSOAPPart().getEnvelope().getBody().toString();

Among them_ Call is org apache. axis. client. Call

Then you can save it in the file you want

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>