BPM, Workflow, and Case

java.util and Packages.javax not defined in service

  • 1.  java.util and Packages.javax not defined in service

    Posted Sun September 05, 2021 03:31 PM
    Edited by Ailin Cao Sun September 05, 2021 04:45 PM
    I'm following the documentation for working with BPM documents to convert Base64 to binary , however in the service I am building, in the script task, I see the error: 'Packages' is not defined. What am I missing?

    This is the documentation: Working with document content

    Documentation code I am trying to run: 
    // Script sample code to set and encode the document content from a file
    var file = new Packages.java.io.File(tw.local.fileName);
    var bytesValue = Packages.org.apache.commons.io.FileUtils.readFileToByteArray(file);

    But basically I just want a way to convert contentStream.content from Base64 to binary to sent to REST API. 

    The API is expecting type: string, format: binary and the method here: Passing files
    is yielding what is most likely an invalid type error: 
    "httpStatusCode":403,"httpStatusMessage":"Forbidden","content":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>


    Ailin Cao
    Associate Application Developer