Monday, June 17, 2013

Retrieving Axis2MessageContext from SynapseMessagecontext

Some times, we need to access Axis2 MessageContext in the sequence flow, using a custom class mediator.
Here is how you can access it;

public boolean mediate(MessageContext synapseMessageContext) {

org.apache.axis2.context.MessageContext axis2MsgContext;
axis2MsgContext = ((Axis2MessageContext) synapseMessageContext).getAxis2MessageContext();
 ..................
}

Thursday, May 2, 2013

Accessing request MessageContext from response's MessageContext in axis2.

In some cases we need to access the incoming requests' properties/message in the outpath/response path.
For instance; we may need the request message's header information or else we might need the request message  in the response path for  any processing logic.
Request message context can be retrieved like as follows;
MessageContext requestMessageCtx = responseMessageCtx.getOperationContext()
.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
Using the Request's MessageContext we could retrieve header details/message etc..