!--a11y-->
Accessing the Web Services Context from a
WS-EJB 
When an enterprise bean method is processed, the logic may require some additional information for the context in which the method is being executed. This includes:
· Specific transport binding information
· Protocol configuration
· General Web services runtime information
This is performed using the following code inside your bean:

|
import javax.naming.*; import com.sap.engine.interfaces.webservices.runtime.ApplicationWebServiceContext; import com.sap.engine.interfaces.webservices.runtime.RuntimeContext;
Properties p = new Properties(); p.put( "domain" , "true"); Context ctx = new InitialContext(p); ApplicationWebServiceContext wsContext = (ApplicationWebServiceContext ) ctx.lookup( " /wsContext/ApplicationWebServiceContext" ); RuntimeContext rt = wsContext.getRuntimeContext(); |
The interfaces mentioned above are located in the webservices_api.jar, and at runtime they are located in the interface:webservicesinterface. If your bean is a Web services implementation, the class loader will automatically set a reference to these interfaces.
For more information about the RuntimeContect interface, see com.sap.engine.interfaces.webservices.runtime package in the Java doc.
See also:
