I am trying to figure out how to add a SOAP header in my client-side
handler.
I have the following axis1 code, but need an axis2 equivalent:
/***********************************************************************
* Processes the header of a request message. This method will add
the
* session header to the outgoing request.
*
* @param context the message context associated with the request
**********************************************************************/
private void invokeRequest( MessageContext context ) throws AxisFault
{
Message msg = context.getRequestMessage();
if (msg == null)
throw new AxisFault( "Message not in context." );
SOAPEnvelope env = msg.getSOAPEnvelope();
SessionHeaderType sessionHeader =
WebServiceClientHelper.getThreadSessionHeader( );
SOAPHeaderElement header = new SOAPHeaderElement(HEADER_NS,
HEADER_NAME,
sessionHeader);
env.addHeader(header);
}
The SessionHeaderType class was generated from a wsdl and contains
session credentials.
Any pointers to appropriate documentation on how to manipulate headers,
or sample code, would be appreciated.