• Post Reply Bookmark Topic Watch Topic
  • New Topic

Print Axis2 Response/Request xml

 
viveks singhs
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to print RAW Request Response XML to console. I have created the stubs using wsdl2java axis2.

wsdl2java has created 2 java files, one for stub and one for callbackhandler.

I am trying with below method but getting null value for operationContext.getMessageContext("Out") / operationContext.getMessageContext("In");.

public void SOAPLogHandler(Stub stub){

ServiceContext serviceConxt = stub._getServiceClient().getServiceContext();

//**** Enable the Cache to hold the last operation
OperationContext OperationContext = new OperationContext();
boolean cacheLastOperationContext = true;
OperationContext.setComplete(true); // Enable the Cache value
serviceConxt.setCachingOperationContext(cacheLastOperationContext);
serviceConxt.setLastOperationContext(OperationContext);

OperationContext operationContext = serviceConxt.getLastOperationContext();

if (operationContext != null) {
MessageContext outMessageContext = operationContext.getMessageContext("Out");
operationContext.getMessageContexts();
if (outMessageContext != null) {
System.out.println("OUT SOAP: "+outMessageContext.getEnvelope().toString());
}
MessageContext inMessageContext = operationContext.getMessageContext("In");
if (inMessageContext != null) {
System.out.println("IN SOAP: "+ inMessageContext.getEnvelope().toString());
}
}


Can you please let me know is there any other way to get the raw xml
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Does this approach work? If so, why are you looking for another?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!