cancel
Showing results for 
Search instead for 
Did you mean: 

Co-Located Beans

Former Member
0 Kudos

Can anybody help me answering the following question.

When can I use co-located beans meaning when can I use local references from a client.

a) Is it within the "border" of an EAR-File.

b) Is it within the EJB-Container and WEB-Containter in each case and not for example when calling a bean from a servlet.

c) Is it within the whole server-process in a Java-Cluster

(I tried but succeeded only in locally calling a bean from another bean within an EAR-File).

Thanx for anybodys clarification

Andi

Accepted Solutions (1)

Accepted Solutions (1)

viliana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andi,

You can use local references in all three cases a), b), and c) above.

It is recommended to access the beans locally from within the same EAR file, as is your example, but it is also possible from other beans or servlets in a different EAR file.

Do not forget to declare the EJB references in your deployment descriptors though. For more information how to declare the references and to access the beans, see <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/accessing%20ejb%20applications%20using%20jndi.pdf">this article</a>.

Best regards,

Viliana

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks,

its a security issue. We want to expose as less remote interfaces as possible in order to restrict access to WEB-AS (beans etc.) from outside.

My last question is:

coming from XI generated Proxy-Inbound-Bean. Do you know if it's possible there to remove the remote-interfaces of the inbound-bean in order to be called only via local references from proxy-servers transport-servlet?

Thank you, Andi

viliana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andi,

I am not sure about your last question. Probably it will not be possible but it really depends on the communication protocol that is used with XI. I suggest that you post your question in the Exchange Infrastructure forum. Probably, you will be able to find the answer to that question there.

Best regards,

Viliana

Former Member
0 Kudos

Thanx,

what I did is:

      • I removed the remote and home-interface from ejb-jar.xml whereas I left the local-interfaces, as follows:

<enterprise-beans>

<session>

<ejb-name>FoxPersistenceClientBean</ejb-name>

<local-home>com.winterthur.ch.fox.persistence.ejbclient.FoxPersistenceClientLocalHome</local-home>

<local>com.winterthur.ch.fox.persistence.ejbclient.FoxPersistenceClientLocal</local>

etc.

      • the call via wsnavigator resulted then in an error "Cannot lookup object with key sap.com/FOX-EAR-DB/FoxPersistenceClientBean. Nested message: Object not found in lookup of FoxPersistenceClientBean.."

      • are you sure the local interfaces are used automatically?

      • this link is describing as precondition a remote interface (http://help.sap.com/saphelp_nw04/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm)

Andi

viliana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andi,

Yes, the documentation is correct - you have to provide the remote interfaces of the bean if you want to expose the bean as a Web Service. This is necessary to define the Web Service. But as I said, if your bean provides a local interface (and if the remote and the local interfaces provide the same methods), then the Web Service will automatically call the local interface thus optimizing the performance. Therefore, it is recommended to provide local interfaces apart from the remote.

Best regards,

Viliana

Former Member
0 Kudos

Thank you very much, Viliana

How can I achieve a generated Web-Service to call it's corresponding bean locally.

Or does it do that automatically?

I removed the beans remote-interfaces before deployment with resulting failure in calling with wsnavigator.

Thanx again, Andi

viliana
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andy,

If your bean provides a local interface, then the Web service will automatically use the local interface.

You can also check the following documentation for further reference: http://help.sap.com/saphelp_nw04/helpdata/en/f7/af60f2e04d0848888675a800623a81/frameset.htm.

Best regards,

Viliana