Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Checking document exists (Foundation > FileUtilsService > Exists)

Avatar

Former Community Member

Hello, I've got a problem with something that should be basic but has got me struggling.

I have a process, its location:

/Applications/RenderPortfolio/1.0/Process/LoadDocuments

I have a PDF document, its location:

/Applications/RenderPortfolio/1.0/Assets/Energy_0511.pdf

The process is very simple, the first activity after the startpoint is to check that the document exists.

To do this I am using:

Foundation > FileUtilsService > Exists

Input (literal value): /Applications/RenderPortfolio/1.0/Assets/Energy_0511.pdf

Output (variable): blnDocumentExists

Each time I invoke and playback this process it retuns blnDocumentExists with a value of "false", when I expected it to return "true" as my document path is correct.

To test my fully qualified path, I replace the Foundation > FileUtilsService > Exists activity with Foundation > RepositoryService > Read Resource Content.

Then invoke, and playback, using the Read Resouce Content as expected the pdf document is located and can be opened.

What am I doing wrong with the Exists activity???

5 Replies

Avatar

Level 10

File Utilities Service cannot be used to search document within Adobe Repository.

Use Read Resource Content acitivity and check for NULL or Empty document. Thats the way you do it..

Nith

Avatar

Former Community Member

Hi $Nith$,

Thanks for the response.

Trouble is when I use Read Resource Content and the document is invalid the process throws an exception instead of continuing along to the next activity.  eg. /Applications/RenderPortfolio/1.0/Assets/Energy_05.pdf

(I've given an incorrect file name, it throws the exception as the file does not exist).

How can force the process to continue past Read Resource Content and instead of throwing an exception return NULL or Empty to my variable?

I'm guessing you do this via an xpath expression, have you got an example of how you implement it?

Avatar

Level 10

Yes, I found that the Exception is not catched by this activity. You can't use the OOB Repository Service.

Here is an alternate way:

You can directly invoke the Repository Service using SOAP (using Web Service activity).

The SOAP URL is http://YOUR_SERVER_NAME:8080/soap/services/RepositoryService?wsdl

There is an operation named resourcesExist

By passing the Resource URI to this web service you can make sure if its exists in the repository or not.

It return either true or false.

Hope that helps,

Nith

Avatar

Former Community Member

Nith,

I have not invoked a SOAP web service from directly within a LiveCycle Process before.

Thus far I have added the Foundation > WebService > Invoke Web Service Activity to my process.

Web Service Options: ???

Web Service Response (variable): blnDocumentExists

What should be inserted into the Web Service Options to correctly invoke the service and pass the file path?

Should  the file path still be passed in the same format? ie. /Applications/RenderPortfolio/1.0/Assets/Energy_0511.pdf

Thanks again for the assistance.

Avatar

Former Community Member

BUMP.

Can anyone else provide assistance.
Still very stuck.