/ Published in: Java
Some webservices require a SOAP header to be added to requests (typically with authentication information). For Domino webservice consumer code, this can be handled by extending the generated stub class and rewriting the service calls that are being used. Those methods all execute a 'createCall'. After you have a handle to the call, you can call this custom method to add headers to it.
NOTE: The oli log methods are to a custom logger (OpenLog) which is setup elsewhere in the class. Delete if not using OpenLog.
NOTE: The oli log methods are to a custom logger (OpenLog) which is setup elsewhere in the class. Delete if not using OpenLog.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
private lotus.domino.websvc.client.Call createSessionHeader(lotus.domino.websvc.client.Call _call) { try { // Create soap header elements 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; oli.logEvent(logMsg, OpenLogItem.SEVERITY_LOW, null); elemSystem.addTextNode(this.sessionID); _call.addHeader(header); return _call; e.printStackTrace(); oli.logError(e); return null; } }