I am writing a webservice and trying to access the requestMessgage object from the lotus.domino.websvc.client.Call object. The reason I want the requestMessage is manipulate the SOAPHeader. Unless I actually add header elements to the request, no header is submitted, which is understandable, so I can use the method “getRequestMessge”, in the hierarchy of call objects to get a handle to the SOAPHeader like this.
SOAPHeader sh = _call.getMessageContext().getRequestMessage().getSOAPEnvelope().getHeader();
But what I discovered was the “getRequestMessage()” returns null. I confirmed it with this snippet of code.
lotus.domino.websvc.client.Call _call = createCall(“SomeOperationName”);
MessageContext mcxt = _call.getMessageContext();
Message msg = mcxt.getRequestMessage();
SOAPEnvelope se = msg.getSOAPEnvelope();
SOAPHeader sh = se.getHeader();
the “msg” object is always null, (getting a nullPointer exception). I can create a header and add it like this :
SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new PrefixedQName(“http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd”, “Security”, “wsse”));
wsseSecurity.setMustUnderstand(true);
wsseSecurity.addChild(createUsernameToken(“SystemUser”, “SystemUser1”,PASSWORD_CLEARTEXT));
_call.addHeader(wsseSecurity);
But I cannot get a handle to the requestMessage nor the SOAPHeader. So it seems that I can add a header into the _call object, but cannot access it. How do you access the requestMessage and then the SOAPHeader ?