Nuxeo REST API - Blob.ConcatenatePDFs - 500 Internal Server Error [SOLVED]

Hi,

I want to merges blobs but when I try `nuxeoClient.operation('Blob.ConcatenatePDFs') .params({ filename: fileName }) .input(blobList) .execute()` , I get {“entity-type”:“exception”,“code”:“org.nuxeo.ecm.automation.InvalidChainException”,“status”:500,“message”:“Failed to invoke operation: Blob.ConcatenatePDFs”} ? And in nuxeo server side I have :

****** chain ******
Name: Blob.ConcatenatePDFs
Exception: InvalidChainException
Caught error: Cannot find any valid path in operation chain - no method found for operation 'Blob.ConcatenatePDFs' and for first input type 'java.util.ArrayList'
Caused by: null
****** Hierarchy calls ******

    at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:238)
    at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:121)
    at org.nuxeo.ecm.automation.server.jaxrs.OperationResource.execute(OperationResource.java:58)
    at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:68)
    ... 115 more
Caused by: org.nuxeo.ecm.automation.InvalidChainException: Cannot find any valid path in operation chain - no method found for operation 'Blob.ConcatenatePDFs' and for first input type 'java.util.ArrayList'
    at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.buildChain(CompiledChainImpl.java:166)
    at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.buildChain(CompiledChainImpl.java:146)
    at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:212)
    ... 118 more
2018-01-16 14:04:25,476 WARN  [http-bio-X.X.X.X-8443-exec-88] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing
org.nuxeo.ecm.webengine.WebException: **Failed to invoke operation: Blob.ConcatenatePDFs**
    at org.nuxeo.ecm.webengine.WebException.newException(WebException.java:133)
    at org.nuxeo.ecm.webengine.WebException.newException(WebException.java:122)
    at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:87)

According with http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.3/viewOperation/Blob.ConcatenatePDFs, We don't need Document path to use this OP ? blobList is enough ?

Must I update my nuxeo platform to have Blob.ConcatenatePDFs Operation in REST API ?

Thanks for your helps

0 votes

5 answers

4509 views

ANSWER

Hi, What version of the JS client do you use? What version of Nuxeo? What's in the blobList variable?
01/16/2018



Hi Thomas,

Here is my CustomConcatenatePDFs from studio (cf : [Capture d’écran 2018-01-18 à 10.11.21.png])

nuxeoClient.operation('CustomConcatenatePDFs')    
.params({        
filename : fileName,        
url : pdfUri    })    
.input(docs) //List of doc to have automatic loop
.execute()

but when I get ressult client side I always have blob ([Capture d’écran 2018-01-18 à 10.11.01 (2).png]) with no stream and name ? MergedPdf : { type : 'text/plain', size : 13284832} It supposed to be a pdf file ?

thanks

0 votes



Hi Thomas,

I solved my issue by creating a customScript server side in studio though automation chains and it works fine.

Thanks a lot

0 votes



Hi Thomas,

If I use Automation scripting to do my merge operation server side, It will works ? It will return readable file (blob) in client side ?

Thanks

0 votes



You can't use Blob JSON definition from a JSON document properties as input of an operation, Nuxeo won't be able to decode it.

For your use case, I would create a custom chain CustomConcatenatePDFs such as:

- Document.GetBlob: {}
- Blob.ConcatenatePDFs: {}

And then call it through:

nuxeoClient.operation('CustomConcatenatePDFs')
  .input(doc) // or just the document id/path if you don't event need to fetch the wole document
  .params({ xpath: 'file:content', filename: fileName })
  .execute()

This way, everything will be done server side: the first operation will retrieve the Blob at file:content from the given document as input and pass it to the Blob.ConcatenatePDFs operatrion as input.

0 votes



Hi Thomas,

So I create a custom chain to get my Blob, then a I do an iteration of it to have blob list and then call Blob.ConcatenatesPDFs OP to get Merged Blob PDF?

I go to try It.

Thanks

01/17/2018

Why doing an iteration? On your example let file :Blob = doc.properties['file:content']; it will be only one blob, always.
01/18/2018

Ok, I change my mind and do something clean but it merge the same file twice or more ?
01/18/2018


I Thomas,

I use latest version of JS client (3.4.1), nuxeo version 8.10 and my BlobList (blob) look like

let  file :Blob  = doc.properties['file:content'];

such as

blob : {data : "[https://server/nuxeo/nxfile/default/2c19d2f0-212e-4f84-9c56-f61c497e9ff9/file:content/CDE-2018-000021%20DEVIS%20MANUEL%20HAVAS.docx](https://server/nuxeo/nxfile/default/2c19d2f0-212e-4f84-9c56-f61c497e9ff9/file:content/CDE-2018-000021%20DEVIS%20MANUEL%20HAVAS.docx "https://server/nuxeo/nxfile/default/2c19d2f0-212e-4f84-9c56-f61c497e9ff9/file:content/CDE-2018-000021%20DEVIS%20MANUEL%20HAVAS.docx")"
digest : "c83dc99ad65f21c5095e2a64965e977f"
digestAlgorithm : "MD5"
encoding : null
length : "13273"
"mime-type" : "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
name : "CDE-2018-000021 DEVIS MANUEL HAVAS.docx"}

I tried doc.getBlobs() but I have blob : { type : application/vnd.openxmlformats-officedocument.wordprocessingml.document, size : 13273}, that's all.

But I always have

2018-01-16 14:04:25,476 WARN  [http-bio-X.X.X.X-8443-exec-88] [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing
org.nuxeo.ecm.webengine.WebException: Failed to invoke operation: Blob.ConcatenatePDFs
    at org.nuxeo.ecm.webengine.WebException.newException(WebException.java:133)
    at org.nuxeo.ecm.webengine.WebException.newException(WebException.java:122)
    at org.nuxeo.ecm.automation.server.jaxrs.ExecutableResource.doPost(ExecutableResource.java:87)
    at sun.reflect.GeneratedMethodAccessor224.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)

Thanks `

0 votes