Expand my Community achievements bar.

How do you get a byte array from a document?

Avatar

Level 1

I have a document variable and I need to pass its contents as a byte array to a web service.  Currently my SOAP request looks like:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">

   <soapenv:Header/>

   <soapenv:Body>

      <tem:GenerateDDXNoTicket>

         <!--Optional:-->

         <tem:resFileContent>/process_data/@inRES</tem:resFileContent>

         <!--Optional:-->

         <tem:sourceFileLocation>inPDF</tem:sourceFileLocation>

         <!--Optional:-->

         <tem:resultFileLocation>outPDF</tem:resultFileLocation>

      </tem:GenerateDDXNoTicket>

   </soapenv:Body>

</soapenv:Envelope>

1 Reply

Avatar

Former Community Member

Give the attached .lca a look. I think it gets the job done. It uses a script as follows:

import com.adobe.idp.Document;

Document document = patExecContext.getProcessDataDocumentValue("/process_data/myDocument");

String str = document.toString();

byte[] byteArray = str.getBytes();

patExecContext.setProcessDataIntValue("/process_data/@byteArrayLength",byteArray.length);

patExecContext.setProcessDataValue("/process_data/myObject",byteArray);

Steve