On Friday 17 December 2004 22:53, Andy Kriger wrote: > For example, let's say I have webservice methods implemented by a > class called BusyBee. I want to grab the ID of the MessageContext > Session and use that as a key in my BusyBee.doSomething() method. I > could call MessageContext.getCurrentContext() in the method, but that > breaks the separation of concerns. So I have a method > BusyBee.setSessionId(). How can I call that method and apply the > MessageContext Session info from outside of BusyBee?
It isn't absolutely necessary that your BusyBee class is the one that's actually exposed as a web service, or is it? Then how about this public interface BusyBee { void someMethod(); void setSessionId(long id); } public class BusyBeeImpl { void someMethod() { ... } void setSessionId(long id) { ... } } public class BusyBeeService implements BusyBee { private final BusyBee _bee = new BusyBeeImpl(); public void someMethod() { MessageContext ctx = MessageContext.getCurrentContext(); ... _bee.setSessionId(...); _bee.someMethod(); } } In case you're using the Spring framework you could do something like this public class BusyBeeService extends ServletEndpointSupport implements BusyBee { private BusyBee _bee; protected void onInit() { ApplicationContext ac = getWebApplicationContext(); _bee = (BusyBee)ac.getBean("busybee"); } public void someMethod() { MessageContext ctx = MessageContext.getCurrentContext(); ... _bee.setSessionId(...); _bee.someMethod(); } } Michael -- Michael Schuerig They tell you that the darkness mailto:[EMAIL PROTECTED] Is a blessing in disguise http://www.schuerig.de/michael/ --Janis Ian, From Me To You