knime server URL to filepath

Following issue happens only in server, In local it works fine.

I had placed few JSON files in knime server outside the WF. Using ListFiles I got he URL of the files, the URL of the files are knime server location and I need to get file path from it, so that i can use the file path variable to the java code to read the files. I am stuck at this place on how to get the file path from the knime server URL. I had tried to use URL to filePath node, but it fails to read the server location.
image

Any suggestions on getting the filepath from URL will be helpful.

Did you try using “List Remote files” ?

Can you use the json reader node instead?

The local path would be a workaround only as the file transfer is typically done in the background via REST

Thanks for the suggestion @Iris

Yes i used json reader and I see the content of the JSON file, As my JAVA code(JAR) accepts only File path, JSON reader wont be useful for my WF.

If you have any suggestion on how to use the output of JSON reader and convert that to file path variable, will be really helpful.

List Remote Files is not useful in my case. As the files are there in knime server, the output will be similar to ListFiles node.

happy to make you an example.

Did I understand the setup correctly:

  • you have a folder living on KNIME Server
  • in this are a some jsons
  • all should in one single table

How get the Jsons on the server? Once, manually or automatic?

I have a folder in knime server with JSON.
If i use list files, URL and location will be given as output. Location column consist of “?” and the URL column contains “knime://knime.workflow/…/…/…/Schema/JSON/dummy-catalogue.json”

  • List item As the URL is knime server URL, My java code is like Files.get(Path(“knime://knime.workflow/…/…/…/Schema/JSON/dummy-catalogue.json” ), which fail to get read the json file in server. Because the URL is doesn’t provide the location of the File( File Path) .

  • List item I am expecting server location like /Schemas/Datadrive/JSON/catalogue instead of URL “knime://knime.workflow/…/…/…/Schema/JSON/dummy-catalogue.json” .

Please see the attached image in the link provided.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.