cancel
Showing results for 
Search instead for 
Did you mean: 

J2EE Engine 6.20, EJB as Webservice, Properties

Former Member
0 Kudos

Hi,

i have a J2EE Engine 6.20 here and i'am developing an EJB to be published as Webservice.

Within the the Bean i use JCO to connect to the R/3:


 JCO.Client client = JCO.createClient("700", "user", "password", "de", "55.55.555.5", "00" ); 

Now, my question:

I want to keep the parameters for <i>JCO.createClient()</i> configurable.

What's the "best practice" way this to do this? Init/Startup-Parameter in an xml?

If yes, in wich one? global-web.xml maybe?

Thanks in advance for all replies,

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Christian,

Since you pass the parameters to JCo inside your EJB, the "best practice" would be to declare them as environment entries in the <i>ejb-jar.xml</i>, e.g.

<env-entry>
  <env-entry-name>UserName</env-entry-name>
  <env-entry-type>java.lang.String</env-entry-type>
  <env-entry-value>user</env-entry-value>
</env-entry>

Then you can simply lookup the necessary entries from the bean JNDI environment like this

InitialContext ctx = new InitialContext();
String userName = (String) ctx.lookup("java:comp/env/UserName");

and pass them to the <i>JCO.createClient()</i> method.

Hope that helps,

Vladimir

Former Member
0 Kudos

Vladimir,

that's exactly what i was looking for.

Thanks a lot

Christian

Answers (0)