Return to Snippet

Revision: 61479
at December 16, 2012 00:23 by lspellman


Initial Code
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;
	        	System.out.println(logMsg);
	        	oli.logEvent(logMsg, OpenLogItem.SEVERITY_LOW, null);
	        	
	        	elemSystem.addTextNode(this.sessionID);
	        	_call.addHeader(header);
	        	return _call;
	        } catch (Exception e) {
	        	e.printStackTrace();
	        	oli.logError(e);
	        	return null;
	        }
	}

Initial URL

                                

Initial Description
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.

Initial Title
Java method to add SOAP header

Initial Tags
header, java

Initial Language
Java