cancel
Showing results for 
Search instead for 
Did you mean: 

Using SLD for making connection to JCO

Former Member
0 Kudos

Hi,

Is there any way to get SAP system connection from SLD . I don't want to manually code JCO client code mentioning the user/password.

Thanks

Naresh

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Naresh,

you can access JCO connections in the SLD using the Web Dynpro runtime service WDSystemLandscape. Please have a look at the following documentation: http://help.sap.com/saphelp_nw04/helpdata/en/25/19e7752be1c8459258a072d87e3a34/content.htm

Note: Connections created/managed by the WD content admin will have no password assigned, these are stored in the secure storage.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

In our model We are using session beans to communicate with RFC instead of Web Dynpro, So we will be unable to use the Web Dynpro Content Admin Properties. Can you suggest the best Alternative/Secure way to do the same.

Thanks

Naresh

Former Member
0 Kudos

Hi Naresh,

i did this sometime ago, but i'm not sure, if this is the recommended and only possible way to do this:

There's an SLD application service available (JNDI name "applsld") which returns a reference to an instance of "SldApplicationServiceInterface".

To get the class at design time you have to add: SAP_SYSTEM_ADD_LIBS/comp/SAP_JTECHS/DCs/sap.com/tc/sld/dp/j2ee/_comp/gen/default/public/default/lib/java/sldserv.jar to your build path.

To get the class at runtime add a Service reference to service "sld", provider "sap.com".

Lookup:

try {
  InitialContext ctx = new InitialContext();
  sldAppService = (SldApplicationServiceInterface) ctx.lookup("applsld");
} catch (NamingException e) {
  ...
}

From this point you can create a CIMOMClient and use this for SLD "browsing". Hope this hasn't changed in the meantime. Maybe somebody knows a better/easier way.

Best regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Can we keep login Information such as UserID/Password in SLD?

Thanks

Naresh

Former Member
0 Kudos

Hi Naresh,

this is possible, but keep the following in mind:

1. Don't maintain these connections with the WD content admin, the password(s) will be overwritten then.

2. It might be not the best solution to store uncrypted passwords in the SLD.

Hope that helps.

Best regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Thanks for the Information, but still some Queries .

In our project we are planning to use sso logon tickets to connect to External R/3 System. In web Dynpro Content Admin we can use this option , But in SLD I was unable to find the same. Can u please tell me If there is some option like that in SLD. Pointer to releavant document will really help .

Thanks

Naresh

Former Member
0 Kudos

Hi Naresh,

the option "useSSO" should be available in a combobox at the bottom of the JCO connection definition page in SLD (default is "useDefinedUser"). The properties are rather well documented in the SLD itself using the corresponding help buttons. Additionally there's configuration/usage documentation available here: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/sso overview.pdf

Hope that helps.

Best regards

Stefan

matt_steiner
Active Contributor
0 Kudos

Hi Stefan,

hm... it seems you know what you're talking about. I read the whole thread, but I'm still not able to get anything useful out of the sld. Basically, I'd want to call the SLD and get information about a named JCO connection (much like what WDSystemLandscpae.getJCOClientConnection("xyz") is probably doing internally).

OK, here's what I got to work so far:

ClientFactory factory = ClientFactory.newInstance();

URL url = new URL("http://localhost:50000");

CIMOMClient client = factory.createClient(url, "admin", "password");

CIMInstancenameList instList = client.enumerateInstanceNames(CIMNames.C_SAP_JCODestination);

for (int i = 0; i < instList.size(); i++)

{

CIMItem item = instList.get(i);

System.out.println(item.toString());

}

But, I have no clue how to get the JCo connection parameters out of this. The API does not really help at all.

Any suggestions would be appreciated.

Regards,

Matthias

Former Member
0 Kudos

Hi Matthias,

(probably for internal use) there's a client library available which provides access to the SAP CIM model:

SAP_SYSTEM_ADD_LIBS/comp/SAP_JTECHS/DCs/sap.com/com.sap.lcr.api.cimclient/_comp/gen/default/public/default/lib/java/lcrclient.jar

After adding the reference to your project you may use something like this (client is the CIMOMClient you already have):

CIMInstancenameJavacimobject cimObjects[] = null;
try {
  SAP_JCODestinationAccessor accessor = new SAP_JCODestinationAccessor(client);
  cimObjects = accessor.enumerateInstances(false, true, null);
} catch (LcrException e) {
  ...
}
if (cimObjects != null) {
  SAP_JCODestination dest = null;
  for (int ix = 0; ix < cimObjects.length; ix++) {
    dest = (SAP_JCODestination) cimObjects[ix].getJavaCIMObject();
    System.out.println(dest.getSystemName());
    /* More properties available */
  }
}

Hope that helps.

Best regards

Stefan

PS: I nearly always no, what i'm talking about, when i'm at all talking about something

matt_steiner
Active Contributor
0 Kudos

Hi all,

thanks Stefan , even though you replied quickly to my email i was able to figure it out by myself in the meantime. So just to post the complete code:

ClientFactory factory = ClientFactory.newInstance();

URL url = new URL("http://localhost:50000");

HttpRequestSender requestSender = new HttpRequestSender(url, "admin", "password");

CIMOMClient cimomClient = new CIMOMClient(requestSender);

CIMClient cimClient = new CIMClient(cimomClient);

SAP_JCODestinationAccessor jcoAcc = new SAP_JCODestinationAccessor(cimClient);

SAP_JCODestination[] jcos = jcoAcc.enumerateSAP_JCODestinationInstances();

for (int i = 0; i < jcos.length; i++)

{

SAP_JCODestination jco = jcos<i>;

System.out.println(jco.getName());

}

Regards,

Matthias

Former Member
0 Kudos

Hi Matthias,

well done. But as a final tip it would be better if you get a reference to the current J2EE engine cluster and use the associated instances of type "hosted JCO connection" for the list retrieval. This will only return the connection instances which are relevant for the current system. Otherwise you might get lots of connection definitions (especially in "real world" production systems) which you aren't really interested in

Best regards

Stefan

Former Member
0 Kudos

Hi Matthiias,

you posted Very useful info. Could you please tell me How you get JCO Connection using this info. as we do not get password info.

Thanks in advance

Sarma ADITHE

Former Member
0 Kudos

Hi Stefan,

Do i need to configure something as it seems the service is not available to my application.