SCA EJB bindings IBM® WebSphere® Application Server V7 Feature Pack for Service Component Architecture SCA EJB™ bindings This presentation covers SCA EJB binding. EJB binding EJB binding Composite Component Component Wire Binding EJB binding Binding EJB binding Service Java Reference Java This diagram shows the use of the EJB SCA binding on both services and references. EJB binding: Overview (1) EJB binding: Overview (1) Allows SCA to integrate with existing JEE based applications Exposes SCA services as stateless session beans to external clients The binding element is used within a component service or component reference definition EJB binding allows SCA to integrate with existing JEE based applications by exposing SCA services as stateless session beans to external clients. The EJB Session Bean binding enables SCA developers to treat previously deployed session beans as SCA services, by wiring them into an SCA assembly as an SCA reference. SCA service deployers expose an SCA service as a session bean for consumption by Java EE applications. The binding element used within a component service or component reference for EJB binding is . EJB binding: Overview (2) EJB binding: Overview (2) Both EJB 2 and 3.0 bindings for service and reference are supported in the SCA feature pack > In the SCA feature pack, support is provided for EJB binding in both 2 and 3.0 style for both service and reference. Support is also provided for reference target. However, something to keep in mind is that, reference target is more of a corner case with EJB binding as compared to what it is in the Web service binding. There is really no reason to go from SCA-to-SCA (such as SCA client invoking SCA service) over EJB binding. Service side EJB binding Service side EJB binding Service side EJB binding applies only to JAR-packaged SCA applications EJB 2: SCA service is exposed through a Stateless EJB for the consumption of EJB2 clients JNDI at /sca/ejbbinding// EJB 3: SCA service is exposed through a Stateless EJB for the consumption of EJB3 clients JNDI at ejb/sca/ejbbinding/SOAAssureServiceComponentViaAny/SOAAssureServiceSCA Service side EJB binding applies only to JAR-packaged SCA applications. For EJB2--> SCA service is exposed through a Stateless EJB for the consumption of EJB2 clients. The stateless EJB for the service is bound to JNDI as shown. Similarly, for EJB3 --> SCA service is exposed through a Stateless EJB for the consumption of EJB3 clients. The stateless EJB for the service is bound to JNDI. Reference side EJB binding Reference side EJB binding Applies to both JAR-packaged applications and WAR-packaged applications URI is used to lookup either EJB 2 home or EJB 3.0 business interface homeInterface: Not used session-type: default value "stateless" ejb-version: default value "EJB2" Reference side EJB binding applies to both JAR-packaged applications and WAR-packaged applications if not otherwise stated. URI is used to lookup either EJB 2 home or EJB 3.0 business interface, following the naming convention of JEE if you are wiring to an existing JEE EJB module. Reference side can define a reference target ( InitialContext ctxt = new InitialContext(); Object remoteObj = ctxt.lookup("ejb/sca/ejbbinding/NewOrderEJB3ServiceComponent/NewOrderService#neworder.sca.jdbc.NewOrderServiceRemote"); NewOrderServiceRemote newOrderRemote = (NewOrderServiceRemote) PortableRemoteObject.narrow(remoteObj, NewOrderServiceRemote.class); Client code SCDL This is an example of SCDL (Service Component Definition Language) that has a service exposed over an EJB 3.0 binding. Also shown is the client code for it. A client that wants to invoke the resultant enterprise bean would treat it like any other enterprise bean and not like a regular SCA service. Not that for Web service binding, CompositeContext.getService is not supported for a non-SCA binding, therefore, a getService() on the CompositeContext would not work here. EJB service binding: Example EJB service binding: Example SCA component services can be made available to JEE applications and clients Only need to include the element Service is exposed through remote stateless session bean ... CompanyComponent/Company ResumeBankExtEJBService ... Should be a remotable interface This is an example of an EJB service binding. SCA component services can be made available to JEE applications and clients by exposing them through remote stateless session bean. In this scenario, element needs to be included. Exposing an SCA service with an EJB binding Exposing an SCA service with an EJB binding Composite Component Component Wire Promote Binding EJB binding Service Java JEE application SCA (non JEE) runtime This pictures shows an SCA Service accessed as an EJB Session Bean. An SCA service is developed that will be called from a Java EE environment. Suppose the Java EE programmer doesn't know the SCA programming model. Suppose the programmer wants to use the Java EE programming model that he knows to invoke the SCA service (Example: new initialContext(), nc.lookup(), and so on). In this case, the SCA service has to be deployed into an SCA runtime that is capable of supporting the EJB binding. Note that deployment of this service can result in the generation and deployment of a session bean, along with its home interface. SCA service accessed as an EJB session bean SCA service accessed as an EJB session bean Service in the SCA composite file (default.composite) CompanyInfoComponent/CompanyInfo Client “lookup” code (CompanyHome)initialContext.lookup("ejb/sca/ejbbinding/CompanyComponent/Company"); Here is an example of how the service in the previous slide may be accessed as EJB session bean. Since the client will use the standard Java EE programming model, the client needs to know the home interface of the SCA service. The service in the sca.composite file will do a “lookup” as shown. Summary Summary EJB session beans are used to implement business services. EJB session beans are used to implement business services. References References SCA Specifications: http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications EJB 3.0 bindings: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cejb_bindingsejbfp.html The Service Component Architecture specifications and the information center article on EJB 3.0 bindings are available at the addresses shown here. Feedback Feedback Your feedback is valuable You can help improve the quality of IBM Education Assistant content to better meet your needs by providing feedback. Did you find this module useful? Did it help you solve a problem or answer a question? Do you have suggestions for improvements? Click to send e-mail feedback: mailto:iea@us.ibm.com?subject=Feedback_about_WASv7SCA_SCABindings_EJB_Binding.ppt This module is also available in PDF format at: ../WASv7SCA_SCABindings_EJB_Binding.pdf You can help improve the quality of IBM Education Assistant content by providing feedback. Trademarks