|
|
Apache Axis2/Java 1.1 or later
There are two ways you can implement this.
1. Add the following method in to your service implementation class.
public void setOperationContext(OperationContext opContext){
................
................
}
2. Implement the org.apache.axis2.Service to your service implementation class. Then by using the setOperationContext() in that you will get access to the message contexts. Thats it! MessageContext inContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN)
To access the OUT message context :
MessageContext outContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT)
Note:This method will only work if you are using one of in-built message receivers coming with Axis2 distribution, such as RPCMessageReceiver, RawXMLINOutMessageReceiver etc.
For Axis2 1.1 or above use the following from your service implementation class instead of the setOperationContext(..)
To get incoming message context:
MessageContext inContext =
MessageContext.getCurrentMessageContext();
To get outgoing message context:
OperationContext operationContext
=inMessageContext.getOperationContext();
MessageContext outMessageContext =
operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
cannot get the messagecontext in axis1.5.1
did you find a solution? if
Is there a place to find help when this does not work?
Classpath problems when using axis2 1.4 with Weblogic 8.1 sp6
Elaborating the issue
Is 'MessageContext.getCurrentMessageContext()' synchronized?
Yes it will
when is setOperationContext() called?
when the setOperationContext() called