cancel
Showing results for 
Search instead for 
Did you mean: 

JAVA access to SLD data

Former Member
0 Kudos

i try to access the SLD and retrieve / push the SLD System Data.

But in a "normal" Java Programm done in eclipse.

should be possible ...

so i found some code examples:


ClientFactory factory = ClientFactory.newInstance();
URL url = new URL("http://SERVER:PORT");
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());
}

for that i import

httpclient.jar, lcrclient.jar, logging.jar, sapxmltoolkit.jar, tc_sec_https.jar

but i ran into some errors...

there is no: ClientFactory.newInstance() method

and

jcoAcc.enumerateSAP_JCODestinationInstances() does not work either

am i on the right track?

can someone provide me a code snippet, link, document,... where i can find more information how to access the SLD

thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Eric,

Hmm, this code runs fine for me. Are you importing

import com.sap.lcr.api.cimclient.ClientFactory;

or another ClientFactory? And one more difference:

use

final URL url = new URL("http", "SERVER", PORT, "/sld/cimom");

instead of

URL url = new URL("http://SERVER:PORT");

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

hi maksim,

fast reply

the import seems to be the problem.

the import com.sap.lcr.api.cimclient.ClientFactory cannot be resolved

the eclipse used the com.sun.security.sasl.ClientFactory... couldn't work.

in which jar i can find the right ClientFactory? so i can use it.

i used the new url string now.

thanks!

DONE

it was an old jar file

because of your reply i found the error. thank you

Message was edited by: Eric Crane

former_member182372
Active Contributor
0 Kudos

Hello Eric,

My NWDS is 2.0.12 and I`m using this jar:

C:\Program Files\SAP\JDT\eclipse\plugins\com.sap.sld.client\lib\lcrclient.jar. There is com.sap.lcr.api.cimclient.ClientFactory with newInstance method.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

i have now the connection to the SLD,

also the user right auth. does work.

but with that code i can't get the system in the SLD.

in the help they talk about.

Getting a Local Copy of a CIM Object

by getCIMClass() and getInstance().

but i do not know how to use that stuff to retrieve

- a list of all systems in the SLD

- use the name of the system to get all detail data

can anyone help me again please?

former_member182372
Active Contributor
0 Kudos

Hello Eric,

try this code

....
// retrieve all JCODestinations
SAP_JCODestinationAccessor jcoAccessor = new SAP_JCODestinationAccessor(cimClient);
SAP_JCODestination[] jcoDestinations      = jcoAccessor.enumerateSAP_JCODestinationInstances();

JCO.Client jcoClient = null;
String user = null;
String pwd = null;

// iterate over all destinations
for (int i = 0; i < jcoDestinations.length; i++)
{
	SAP_JCODestination jcoDestination = jcoDestinations<i>;
	user = jcoDestination.getLogonUser();
	pwd = jcoDestination.getLogonPwd();

	if (jcoDestination instanceof SAP_AppServJCODestination)
	{
		SAP_AppServJCODestination jcoDest = (SAP_AppServJCODestination) jcoDestination;
					
		jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
									 user,
									 pwd,
									 jcoDest.getLogonLanguage(),
									 jcoDest.getAppServHost(),
									 jcoDest.getAppServNumber());

	}
	else if (jcoDestination instanceof SAP_MsgServJCODestination)
	{
		SAP_MsgServJCODestination jcoDest = (SAP_MsgServJCODestination) jcoDestination;
			
		jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
									 user,
									 pwd,
									 jcoDest.getLogonLanguage(),
									 jcoDest.getMsgServHost(),
									 jcoDest.getSAPSystemName(),
									 jcoDest.getLogonGroup());
	}	
}

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

thanks again Maksim

you are my hero of the day

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello Experts!

I'm trying the same explained in this post, but I'm using NWDS 7.3 with JDK 1.5. The factory.createClient(url, user, pwd) is deprecated and I can't find which class to use.

Can you please help me? I need to have access to SLD data via Java.

Thanks,

Alberto

0 Kudos

Hello,

I am trying to read SLD data via a webdynpro application. I am using NWDS 7.1.

Could someone help me with the code? I have done in NWDS 7.0 with java 4 but it seems to be completely different in java 5 or at least I need other packages for the import. Please help!

Greets,

Diana

venkatesh_r
Employee
Employee
0 Kudos

I have used the above code to get the list of business systems from SLD. But i get the length as 0 in response though i have several business systems in my SLD.

Former Member
0 Kudos

Hi Eric/Maksim,

When i used your code, it gives compilation error in code stating that invalid reference for type "com.tssap.dtr.client.lib.protocol.session.sessionContext"

From where i can get this class? Which JAR i need to add in my application?

Regards,

Bhavik