Monday, July 15, 2013

Error in GET_DYNAMIC_CONVERSION service

If you are familiar with UCM (Webcenter Content) document services and RIDC, I suppose you know that the service can return the Binder or the input stream. Today I encountered the case where service returns the Binder when one might expect a stream.
As described in documentation the GET_DYNAMIC_CONVERSION service "returns a content item as an HTML or XML file converted by Dynamic Converter", and next "Given a dID or a dDocName and a RevisionSelectionMethod parameter, the service determines the filename of a particular rendition of the revision and returns that file to the client. The most likely errors are mismatched parameters or a request for a content item that does not exist."
There isn't any reason to assume that the service returns anything else than the stream. But, if you run in RIDC code visible bellow
  

public static renderDynamicConversion(String id, IdcClient idcClient,
                                               IdcContext userContext) throws Exception{
          DataBinder binder1 = idcClient.createBinder();
          binder1.putLocal("IdcService", "GET_DYNAMIC_CONVERSION");
          binder1.putLocal("DCViewFormat", "WebViewable"); 
          binder1.putLocal("ConversionTemplate", "SLIDE-PREVIEW");
          binder1.putLocal("dDocName", id);
          binder1.putLocal("RevisionSelectionMethod","LatestReleased");

          ServiceResponse responseS =
              idcClient.sendRequest(userContext, binder1); 
and next you call
  
          inputStream = responseS.getResponseStream();
the Exception will be thrown, because the service returns a Binder no t a stream. You can simply check this calling
  
          responseS.getResponseType();

After some googling I haven't any sure clue, is it a bug or maybe documentation is as usual incomplete. Next I went to Oracle support, and voila, there is a bug: " When using the HTTP web connection method, RIDC always appends IsJava=1 to the request. This cannot be changed to IsJava=0 or unset, which results in all GET_DYNAMIC_CONVERSION calls to Content Server returning the data binder rather than the converted HTML. " Only valid workaround is using socket connection to content server and setting IsJava to 0 as shown below:
  

public static renderDynamicConversion(String id, IdcClient idcClient,
                                               IdcContext userContext) throws Exception{
          DataBinder binder1 = idcClient.createBinder();
          binder1.putLocal("IdcService", "GET_DYNAMIC_CONVERSION");
          binder1.putLocal("DCViewFormat", "WebViewable"); 
          binder1.putLocal("ConversionTemplate", "SLIDE-PREVIEW");
          binder1.putLocal("IsJava", "0");
          binder1.putLocal("dDocName", id);
          binder1.putLocal("RevisionSelectionMethod","LatestReleased");

          ServiceResponse responseS =
              idcClient.sendRequest(userContext, binder1); 

No comments:

Post a Comment