|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
You can access a web service from a stateless session bean by creating a resource manager connection factory reference to the web service.
|
Note: In EJB 3.0, an environment reference to a web service is not needed. You can access a web service directly using annotations and resource injection. |
For each client in which you want to access a resource manager connection factory, you must either inject it in the client source code or define an environment reference to it in the client's deployment descriptor.
To create an environment reference to a web service:
Define a logical name for the web service.
Define a <service-ref> element in the appropriate client deployment descriptor (see "Where Do You Configure an EJB Environment Reference?") and configure the following sub-elements:
<service-ref-name>: a logical name for the web service.
<service-interface>: the destination class type; either javax.jms.Queue or javax.jms.Topic.
Example 19-14 shows a <service-ref> element for a web service.
It is a best practice to start the reference name with "service" but it is not required. In the bean code, the lookup of this reference (see Example 30-1) is always prefaced by "java:comp/env" (for example, "java:comp/env/service/myService")
Map the logical name to the actual JNDI name.
Define a <service-ref-mapping> element in the corresponding OC4J-specific deployment descriptor (see "Where Do You Configure an EJB Environment Reference?") and configure its name attribute to the web service logical name (defined in the <service-ref>) and the <service-qname> sub-element.
Example 19-9 shows a <resource-env-ref-mapping> element for a web service.
For information on looking up and using a web service , see "Using a Stateless Session Bean with a Web Service".