How to import Oauth java library with JSON config and private cert files in Outsystem

How to import Oauth java library with JSON config and private cert files in Outsystem

  

Hi, I have successfully created a Java wrapper library to interact with Xero API for my private Xero App based on Xero Java Github's documentation.


The wrapper library in Java eclipse contains Json config files and private certificate pfx file in the resources folder. I can import the jar files from my wrapper library to the java extension project but how do I import files such as json config file and the pfx file?


Please help as my wrapper library is working in my eclipse ide but I am stuck in implementing it in the Eclipse ide for Outsystems as i do not know how to import the config file and pfx file into the project

Hi Sanjay,

First, and very important, do you have an on-premise enterprise solution that runs the Java stack? Because if not, e.g. if you are using cloud, the Platform runs on .NET, and you cannot use Java code.

Assuming that you do run the Java stack, you need to create an OutSystems Extension using Integration Studio. In Integration studio you can easily add resource files the Extension needs, and specify where they must be placed so that the Extension can access them.

Hi Kilian,


Thanks for your reply.  Yes, I have checked that my servers are run java stack. Thanks for pointing it out.


I am aware that I can add the resource files in integration studio. I placed the jar files in the lib folder. However, I do not know where to put other external files like certificates and JSON file. Do i place them in outsystems records directory? Do correct me if i am wrong.


Appreciate your help.



Kilian Hekhuis wrote:

Hi Sanjay,

First, and very important, do you have an on-premise enterprise solution that runs the Java stack? Because if not, e.g. if you are using cloud, the Platform runs on .NET, and you cannot use Java code.

Assuming that you do run the Java stack, you need to create an OutSystems Extension using Integration Studio. In Integration studio you can easily add resource files the Extension needs, and specify where they must be placed so that the Extension can access them.



Hi Sanjay,

You can decide yourself where the resources live design time. If you add a subdirectory to your folder, Integration Studio will show that subdirectory, and you can expand it in the tree control, select the file to include and from the context menu select "Include in Extension". Instead of grey, Integration Studio will show it in black.

Next, you need to select a "Deploy Action". Double click the file, and select one of the possible options.

You have the choice between the Application directory, which is the base directory of the app, the Binaries directory which is the bin/ sub directory, or the Images directory which is the img/ subdirectory. So runtime, there's a limited choice where to put things.

Hi Kilian, 

Thanks for the reply. I thought your solution worked. I added the json config file and the certificate pfx file in the java extension. I created a sample test class to execute the code and it would generate the desired output from Xero web service. The project could be compiled and published successfully too.


However, after publishing, the uploaded json config file could not be read by Outsystems and I had to delete and put back the file to allow the test application to read the json config file. But after successfully republishing the project, Outsystems will again be unable to read the json config file. 


Any thoughts on this? Any help will be greatly appreciated.


Kilian Hekhuis wrote:

Hi Sanjay,

You can decide yourself where the resources live design time. If you add a subdirectory to your folder, Integration Studio will show that subdirectory, and you can expand it in the tree control, select the file to include and from the context menu select "Include in Extension". Instead of grey, Integration Studio will show it in black.

Next, you need to select a "Deploy Action". Double click the file, and select one of the possible options.

You have the choice between the Application directory, which is the base directory of the app, the Binaries directory which is the bin/ sub directory, or the Images directory which is the img/ subdirectory. So runtime, there's a limited choice where to put things.



Hi Sanjay,

It can't be read because it can't find the file at all? Did you try to download it by using the URL of the eSpace + directory + name of the file to see if it's there?