Skip to content

Instantly share code, notes, and snippets.

View lspellman's full-sized avatar

Lance Spellman lspellman

View GitHub Profile
@lspellman
lspellman / add_session_header.java
Created March 9, 2014 23:44
When Domino is used to create a webservice consumer, it does not provide an easy way to add SOAP headers to method calls. To do so, extend the STUB class it provides, copy any methods that need SOAP headers, and insert a line after the 'createCall' to provide that functionality. See snippet 69125 for the details of the 'createSessionHeader' code.
public QueryService_pkg.QueryResult queryFirst(QueryService_pkg.QueryRequest request) throws java.rmi.RemoteException {
lotus.domino.websvc.client.Call _call = createCall("queryFirst");
_call = createSessionHeader(_call);
java.lang.Object _resp = _call.invoke(new java.lang.Object[] {request});
this.queryHeader = _call.getResponseMessage().getSOAPEnvelope().getHeaderByName(new QueryServiceLocator().getServiceName().getNamespaceURI(), "QueryHeaderValue");
return (QueryService_pkg.QueryResult) _call.convert(_resp, QueryService_pkg.QueryResult.class);
}
private lotus.domino.websvc.client.Call createSessionHeader(lotus.domino.websvc.client.Call _call) {
try {
// Create soap header elements
String namespace = "urn.QueryService";
lotus.domino.axis.message.SOAPHeaderElement header = new lotus.domino.axis.message.SOAPHeaderElement(namespace, "SessionHeaderValue");
header.setMustUnderstand(false);
SOAPElement elemSystem = header.addChildElement("sessionID","","");
// check to see that we actually have the session id
logMsg = "checking sessionID: " + this.sessionID;