Pages

Get a Document out of WebCenter Content by ID

The use case was to show PDFs in the browser that come out of WebCenter Content.
I achieved this by using the RIDC library.

The information you need, you can find in the WebCenter Content Admin Server.
Login and go to the General Configuration. Look up the IntradocServerPort number that is configured there, so you know the portnumber for the call.

It only takes a few lines of code to get the InputStream from the document:
      IdcClientManager manager = new IdcClientManager();
      IdcClient idcClient = manager.createClient("idc://servername:portnumber");
      IdcContext idcContext = new IdcContext("username", "password");

      DataBinder requestBinder = idcClient.createBinder();
      requestBinder.putLocal("IdcService", "GET_FILE");
      requestBinder.putLocal("dID", "id");

If you want you can get some extra info from the response:
    response.getHeader("Content-Length");
    response.getHeader("Content-type");
    response.getHeader("Content-Disposition");

And that’s probably all you need. 

No comments:

Post a Comment