Hi Jen-Ya,
I see that you have two options to solve your problem:
First if you are using RawXML*MesageReceivers, then you can use the
message context injection mechanism that is available.
This requires you to declare a method 'init' that accepts one or two
message contexts in your service implementation class, depending on
the MEP (IN only or IN-OUT respectively)
public void init(MessageContext inMsgCtx) {
}
OR
public void init(MessageContext inMsgCtx, MessageContext outMsgCtx) {
}
Using this method you can get hold of SOAPEnvelope using
msgCtx.getEnvelope() and other information at the service. Also since
you are coming from the Axis1.x world please note that Axis2 has
different message contexts for each of the messages.
Please have a look at org.apache.axis2.swa.EchoSwA service class in
the integration test cases.
(http://svn.apache.org/viewcvs.cgi/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/swa/EchoSwA.java?view=markup)
Second option is to write your own message receiver where you will
have access to the request message context.
Thanks,
Ruchith
On 9/28/05, Jen-Ya Ku <[EMAIL PROTECTED]> wrote:
>
> Hi, All:
>
> In Axis, we can use following to get headers: However, for Axis2 service,
> how to get/set header?
>
> Thanks for your info.
>
> Thanks,
> Jen-Ya
> ---------------------------------------------------------------------------------------------------------------------------------
> // Axis1x Get current message context
> MessageContext ctx =
> org.apache.axis.MessageContext.getCurrentContext();
>
> // Get SOAP envelope of request
> SOAPEnvelope env = ctx.getRequestMessage().getSOAPEnvelope();
>
> // Get Header
> SOAPHeaderElement soapHeaderElement =
> env.getHeaderByName(headerNamespace, headerName);
> -----------------------------------------------------------------------------------------------------
--
Ruchith