Reputation: 735
I am trying to log the request and response of a wsdl using Apache axis 2. I got some solution from internet of adding some SOAPHandler and add client-config.wsdd but i am not able to make it working at my place. Anybody can provide me a working solution or any reference which works actually.
Any help will be appreciated.
Upvotes: 2
Views: 4064
Reputation: 461
In Axis2 exchanged messages are represented in OperationContext
. So after the invocation of the service;
StringBuffer xmlRequestMessage = new StringBuffer();
StringBuffer xmlResponseMessage = new StringBuffer();
OperationContext operationContext = stub._getServiceClient().getLastOperationContext();
// For request message
MessageContext requestMessageContext = operationContext.getMessageContext("Out");
xmlRequestMessage = new StringBuffer(requestMessageContext.getEnvelope().toString());
// For response message
MessageContext responseMessageContext = operationContext.getMessageContext("In");
xmlResponseMessage = new StringBuffer(responseMessageContext.getEnvelope().toString());
Upvotes: 1