Archive

Posts Tagged ‘webservice provider’

Lotus/Domino 8.5 WebService Provider manipulating SOAP Header

July 28, 2010 1 comment

Similar to previous post Domino WebService Consumer manipulating SOAP Header WebService Provider in some cases have to read SOAP Header passed. It may process the header (e.g log it’s data) and send enhanced Header back along with response. To achieve that we have to add some code to inspect and inject SOAP Header to the payload. Steps are shown below.
Locate generated Web Service Stub with the methods prepared for implementation and access MessageContext to read and set Header:

public void echo()
{
MessageContext mc = MessageContext.getCurrentContext();
// get received SOAP Header
SOAPHeaderElement header = mc.getRequestMessage().getSOAPEnvelope().getHeaderByName(wsNamespace, "auth");

// manipulate header

// set new manipulated header to response
mc.getResponseMessage().getSOAPEnvelope().addHeader(header);
}

Advertisements