cancel
Showing results for 
Search instead for 
Did you mean: 

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

freemann_
Star Contributor
Star Contributor

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

1 ACCEPTED ANSWER

freemann_
Star Contributor
Star Contributor

Hi Thomas,

Here is my CustomConcatenatePDFs from studio (cf : [Capture d’e´cran 2018-01-18 a` 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’e´cran 2018-01-18 a` 10.11.01 (2).png]) with no stream and name ? MergedPdf : { type : 'text/plain', size : 13284832} It supposed to be a pdf file ?

thanks

View answer in original post

9 REPLIES 9

Thomas_Roger
Star Contributor
Star Contributor

Hi,

freemann_
Star Contributor
Star Contributor

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
`

Thomas_Roger
Star Contributor
Star Contributor

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.

Hi Thomas,

Why doing an iteration? On your example `let file

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

freemann_
Star Contributor
Star Contributor

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

freemann_
Star Contributor
Star Contributor

Hi Thomas,

Here is my CustomConcatenatePDFs from studio (cf : [Capture d’e´cran 2018-01-18 a` 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’e´cran 2018-01-18 a` 10.11.01 (2).png]) with no stream and name ? MergedPdf : { type : 'text/plain', size : 13284832} It supposed to be a pdf file ?

thanks

freemann_
Star Contributor
Star Contributor

Hi Thomas,

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

Thanks a lot

Getting started

Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.