I've set up an axis web service client by extending the Spring JaxRpcPortProxyFactoryBean. The web service calls work fine but I want to (for auditing) also capture the raw XML request/response for each call. It seems to me the only way to do this is to override the method:
JaxRpcPortClientInterceptor.performJaxRpcCall(Meth odInvocation invocation, Service service), see below:
I'm going to have to copy a chunk of code to do this though and it doesn't feel right. Is there a more sensible extension point/hook/intercepter that I can use to use to capture the request/response ?Code:public class JaxRpcPortClientInterceptor extends LocalJaxRpcServiceFactory implements MethodInterceptor, InitializingBean { //From protected Object performJaxRpcCall(MethodInvocation invocation, Service service) throws Throwable { ....... // Perform actual invocation. try { return call.invoke(invocation.getArguments()); } ..... } //To protected Object performJaxRpcCall(MethodInvocation invocation, Service service) throws Throwable { ....... // Perform actual invocation. try { MyReturnType result; Object o = call.invoke(invocation.getArguments()); result = (MyReturnType) o; String xmlRequest = ((org.apache.axis.client.Call)call) .getMessageContext() .getRequestMessage() .getSOAPPart() .getEnvelope() .getBody() .toString(); String xmlResponse = ((org.apache.axis.client.Call)call) .getMessageContext() .getResponseMessage() .getSOAPPart() .getEnvelope() .getBody() .toString(); result.setXmlRequest(xmlRequest); result.setXmlResponse(xmlResponse); return result; ..... }
Thanks


Reply With Quote