LEAD (Linked Environments for Atmospheric Discovery) related functionality such as shared SOAP Header.


LEAD Related Classes

LeadContextHeader wraps SOAP Header (it can wrap any XmlElement) but for convenience use StickySoapHeaderHandler (xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler) to easily put LEAD context header on client side:

LeadContextHeader leadContext = new LeadContextHeader("uid:experiment:233223");
leadContext.setWorkflowId("http://host/2005/11/09/workflowinstace");
leadContext.setNodeId("decoder1");
leadContext.setTimeStep("5");
leadContext.setServiceId("{http://example.org/decoder}decoder-instance-10");
leadContext.setEventSink(new WsaEndpointReference(URI.create("http://broker.location/topic")));
//...
WSIFClient wclient = WSIFRuntime.newClient(wsdlLoc)
  .addHandler(new StickySoapHeaderHandler("notif-header", leadContext))

This handler will automatically add LEAD context header to every SOAP message sent using WSIFClient.

On server side similarly add StickySoapHeaderHandler but in this case there is no need to set values for LEAD context as they will be retrieved from incoming SOAP message sent by client:

XService xsvc = ...
xsvc.addHandler(new StickySoapHeaderHandler("retrieve-lead-header", LeadContextHeader.TYPE));

And inside a service implementation that uses such server side handler it is very easy to access LEAD context headers (due to "magic" of thread context local storage):

LeadContextHeader nh = (LeadContextHeader) StickySoapHeaderHandler.
  getHeaderAs(LeadContextHeader.class, LeadContextHeader.TYPE);

More details and fully working exampel is in tests/xsul/async_msg directory. To run it after compiling xsul with ant and set CLASSAPTH (source classpath.sh or run classpath.bat) execute (-Dlog is used to see headers and check other options to control async behavior etc.) and grep output for "lh:context":

java -Dlog=trace -Dstart_server xsul.async_msg.EchoAsyncClient -no_stub -count 2 -client_port 3333

or for simple SOAP request-response:

java -Dlog=trace -Dstart_server xsul.async_msg.EchoAsyncClient -count 2

Last modified: $Id: package.html,v 1.2 2006/10/18 06:12:41 aslom Exp $