0 Replies Latest reply on Mar 20, 2018 1:41 PM by RAFAEL PINO

    DocumentServicesClient example

    RAFAEL PINO Newbie



      I want to upload a document using the REST API and then I want to show it using a Form.


      I've been able to upload the document by using the following class: DocumentServicesClient. Here is my code:


      DocumentServicesClient docServices = client.getServicesClient(DocumentServicesClient.class);

      // Creates a document into kie-server

        DocumentInstance doc = new DocumentInstance();



        URL docURL = new URL("");


        String name = "admin";

        String pass = "admin";

        String authString = name + ":" + pass;

        System.out.println("auth string: " + authString);

        byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());

        String authStringEnc = new String(authEncBytes);

        System.out.println("Base64 encoded auth string: " + authStringEnc);

        URLConnection urlConnection = docURL.openConnection();

        urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);

        InputStream is = urlConnection.getInputStream();

        byte[] docContent = IOUtils.toByteArray(is);




        String docId = docServices.createDocument(doc);


      The document is created and I can see it using the REST API



      Now, I wanna show it by using a user task in a Form. How can I accomplish this?. Is there any way to show the document in a user Form?.


      Thank you.