In Progress

Using SaveEntity SOAP web service to save a pdf file in Bizagi not working

I have a project in java which is going to call saveEntity WebService Soap and update some fields, one field is a File. I read in bizagi wiki the xml structure of the call ( name Attribute, FileName , File content).

I have used http://itextpdf.com/ jar to create a pdf and then http://commons.apache.org/proper/commons-codec/download_codec.cgi to encode in Base 64 . When I call the service I can update other fields but I can't update the File field.

Here is my code:

ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Document document = new Document(); PdfWriter.getInstance(document, outputStream); document.open(); Paragraph paragraph = new Paragraph("TestParagraph"); document.add(paragraph); document.close(); byte[] bytes= outputStream.toByteArray(); byte[] encodedBytes = Base64.encodeBase64(bytes);

String xml = "<BizAgiWSParam>"+ "<Entities>"+ "<Cotizacion key=\"358\">"+ "<Adjunto>"+ "<File fileName=\"test.pdf\">"+encodedBytes+"</File>"+ "</Adjunto>"+ "<Lista>true</Lista>"+ "<Total>600.60</Total>"+ "</Cotizacion>"+ "</Entities>"+ "</BizAgiWSParam>";

String result = saveEntityAsString(xml);

When I executed in result I get : "<?xml version="1.0" encoding="utf-8"?><Entities><Cotizacion>358</Cotizacion></Entities>". Then no problem in call. encodededBytes variable has the value of =[B@1db87736, which seems correct. So I dont know If there is a step that I am missing . Also my File field is called "Adjunto".

Thanks

Juan Carlos Jara

Comments (6)

photo
0

I correct bytes generation in string like this: byte[] bytes= outputStream.toByteArray();

String encodedBytes= new String(Base64.encodeBase64(bytes));

Now I generated something that looks more like the web example. Yet I can't set fill when I update this value I can't see the pdf asigned to the chosen field.

photo
1

Hi, Jara.

Thanks for sharing your problem. I wonder have you ever worked it out? I have a question for you. Do you have any other simpler method about pdf to jpg conversion? I want to look for a fine pdf to image converter whose way of processing is simple and fast. Any suggetsion will be appreciated. Thanks in advance.

Best regards,

Lee

photo
photo
0

Hi, could you tell me, how to make a post to this forum?

photo
0

Juan Carlos Jara wrote:

I correct bytes generation in string like this: byte[] bytes= outputStream.toByteArray();

String encodedBytes= new String(Base64.encodeBase64(bytes));

Now I generated something that looks more like the web example. Yet I can't set fill when I update this value I can't see the pdf asigned to the chosen field.

Dear Juan Carlos

A member of our support team will contact you.

best regards

Luis Emilio

photo
0

Bolotov Anatoliy wrote:

Hi, could you tell me, how to make a post to this forum?
Dear Bolotov

To initiate a new topic you may enter to http://feedback.bizagi.com/suite/en and type your question / problem/ idea / compliment using the first box in the page (see image)

p0vr

After you type your text click the "Find similar post" button, this search in the forum to find a previous similar topic that can help you. if there is no match to your search topic you will be redirected to the Start New Post page, where you can choose the type of post you want to write.

best regards

Luis Emilio

photo
0

Luis Emilio Ayazo Cardona wrote:

Juan Carlos Jara wrote:

I correct bytes generation in string like this: byte[] bytes= outputStream.toByteArray();

String encodedBytes= new String(Base64.encodeBase64(bytes));

Now I generated something that looks more like the web example. Yet I can't set fill when I update this value I can't see the pdf asigned to the chosen field.

Dear Juan Carlos

A member of our support team will contact you.

best regards

Luis Emilio

Can you tell solution and me?

I have same problem:

http://feedback.bizagi.com/suite/en/responses/file-does-not-upload-when-i-use-function-saveentity