cancel
Showing results for 
Search instead for 
Did you mean: 

How to install JAVA API client files :: Using JAVA Proxy & NWDS

Former Member
0 Kudos

Hi

I am going to integrate the SAP with one "AB" System which is providing Java API to integrate with their client ( which in turn will connect with AB System ). So AB System is providing JAR files & property files, in order to instantiate objects & call those APIs.

Now I am going to write the JAVA code in NWDS which is installed on my Laptop so I am sure I need to give this jar files under ::

<i>Project -> Properties and then Java Build Path -> Libraries.

Choose Add External JARs</i>

But where do I need to add property files.

Also do I need to install the same files on XI Server too & do I need to install the "AB" System Client also on XI Server or it can be installed some place else too.

Regards

- Lalit -

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The basic concept behind property files is they are treated as an "resource" when inside runtime invironment. They are loaded by the classloader. Dont try to use plane Java IO inside your Java proxy as the Java proxy being EJB code , plain Java IO is discouraged. Instead if your Java proxy is structured to have the following pacakge

e.g. com.yourcompany.pkg1

then navigate to the physical location onto your hard drive where the folder <b>pkg1</b> is and place your properties file and then inside your code you can load it as

Properties properties = new Properties();
InputStream iStream = getClass().getResourceAsStream("XYZ.properties");
properties.load(iStream);

And then access properties object as you usually do.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

I developed the code in NWDS & deployed the EAR file using SDM. Now I updated my code & " rebuild " it & then re-deploy the EAR file using SDM.

But after execution I am still getting old results from previous code.

Pls. let me know what do I need to do so that it can realise the updates.

- Lalit -

bhavesh_kantilal
Active Contributor
0 Kudos

Lalit,

If nothing works, a restart would for sure!

Regards

Bhavesh

Former Member
0 Kudos

Bhavesh

I deleted the old EAR file & then deploy again which resolved the problem.

But as the code is getting deployed in XI Server so when I am executing it, getting an exception. It is looking for the Property file & JAR file of the client.

The way we include the JAR file in the classpath of NWDS, do we have any way in which we can include the JAR file in XI Server.

- Lalit -

bhavesh_kantilal
Active Contributor
0 Kudos

Lalit,

When you are creating the EAR file, you would need to make sure that the JAR file is also a part of the EAR file.

Regards

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Lalit,

><i>But where do I need to add property files</i>

How are you going to access the properties file? Are you going to use Java IO to read the file or are you dgoing to bundle the property file as a resource and use the getResource() . If you are going to use Java IO then you will have to hard code the property file path in your code and make sure that your Proxy can read the property file.

If your property file is going to vary across environments, I woudl suggest this approach. Make sure that the property file path will be same in all environments and it will work fine and make sure that your proxy will have OS level IO access as well.

Another option would be to have the property file bundled as a respurce, but, making changes to the file in this case will be an issue!

><i>Also do I need to install the same files on XI Server too & do I need to install the "AB" System Client also on XI Server or it can be installed some place else too.</i>

When you create the EAR file for your Java Proxy, remove all XI .jar files and just make sure that the Client JAR is available in the EAR file. You need not install the Client JAR file anywhere as long as the jar file is a part of the EAR!

Regards

Bhavesh

Former Member
0 Kudos

Hi,

The following link provides a step-by-step how-to in developing java proxy:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d06315a6-e66e-2910-039c-ba8bbbd2...

As for properties file, if it is need by the XI server during runtime, it can be included in the EAR file. Otherwise, if it is only client-specific, then you can dictate where the file should reside.

Regards,

Bill

Former Member
0 Kudos

Thanks Li.

But using that PDF I already developed one Test scenario with Server Java Proxy. But now my question is more specific with the installation of external files & the client provided by that system.

I know how to develpo the code, creating objects & calling functions. But how do I need to relate my code with the JAR & property files & with that client.

>> As for properties file, if it is need by the XI server during runtime, it can be included in the EAR file.

I am not much into JAVA, can you tell me how I can add property file in EAR file.

- Lalit -