Sending a PDF document through a web service

Good day. I have a big task, and the last part is sending the document through a web service.

Generally speaking, I need to send not only a document, but an array of objects, among which there are documents. Documents will be in PDF format.

As I could see, the "Content type" field is protected from changes and is always JSON.

Is there any simple (or at least some) way to accomplish the task sent to me?

I have an example of performing this task in Java and there the document is loaded into the stream and then passed as an attribute ContentReference, but I do not understand how to implement this in bpm'online ..

Like 0

Like

3 comments

It's hard to understand where you want to send the document from. From bpm'online to a third party, or vise versa. If it's from bpm'online please do that via c# in a Script task in a business process. If it's vise versa, please use the same web service that we call when we add a new file to a "File" detail. Please use Fiddler in order to find the service name. 

Eugene Podkovka,

Thank you very much, I finally realized that I had to do this through C# in the Script task, but now I have another problem.

I found a code (https://stackoverflow.com/questions/17027159/how-send-a-pdf-by-post-htt…) that converts the PDF file into bytes and sends them via HttpWebRequest, but I don’t know how to get a document file.

I mean, the Server.MapPath method is used in this example, but I cannot do this. I only know that this document should be on the "Attachments and notes" tab in Contact. Is there a way to get a link to the desired document (by name, etc.) Or use the MapPath function?

I am also trying to figure out how to attach more data than just a file, because the file is just one of them. The following is the complete structure:



If you have any suggestions or tips, please, help me.

Dear Pavlo,

Please note that all documents are saved in the database in the appropriate table. For example, documents from the “Attachments and notes” tab from the Contact section are saved in the “ContactFile” table and have the object name “Contact attachment”. Therefore, it’s possible to read it like ordinary data from the database.

Please note that the column with data of the document has name “Data” and type “varbinary(max)”. In order to read data from the database please use “Read data” element of business process or use ESQ in the code of the Script task element.

Please find more detail instructions about reading and using data in the Script task element from the link below:

https://community.bpmonline.com/questions/how-read-entity-lookup-column-script-task

Best regards,

Norton

Show all comments