Have a look at javax.ejb.SessionContext
/** Obtain a reference to the JAX-RPC MessageContext. An instance of a * stateless session bean can call this method from any business method * invoked through its web service endpoint interface. * * @return The MessageContext for this web service invocation. * @throws IllegalStateException - Thrown if this method is invoked while * the instance is in a state that does not allow access to this method. */ public MessageContext getMessageContext() throws IllegalStateException;