Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    [BUG] binary field with encodeInResponse=false is null in DMI method

    SmartClient Version: v10.1p_2016-02-11/Enterprise Deployment (built 2016-02-11)

    Hello, I've got a binary field on a dataSource defined like this (note the encodeInResponse="false"):
    Code:
            <field sqlType="blob" name="ALLEGATO" type="binary" encodeInResponse="false"></field>
    and an operationBinding like this:
    Code:
            <operationBinding operationType="fetch" operationId="allegatiJpcb2b" serverMethod="allegatiJpcb2b" 
                              outputs="ALLEGATO_ID,ALLEGATO,ALLEGATO_FILENAME,ALLEGATO_FILESIZE">
                <serverObject lookupStyle="new" className="com.juve.jpcep.cms.LinksDMI"/>
            </operationBinding>
    and a DMI method like this:
    Code:
        public DSResponse allegatiJpcb2b(DSRequest dsRequest) throws Exception {
            dsRequest.setCriteria("ID_REC", dsRequest.getCriteriaValue("ALLEGATO_ID"));
            DSResponse dsResponse = dsRequest.execute();
            Map dataMap = dsResponse.getDataMap();
            Object allegato = dataMap.get("ALLEGATO");
            String base64Encode = DataTools.base64Encode((InputStream) allegato);
            dataMap.put("ALLEGATO", base64Encode);
            return dsResponse;
        }
    previously it was working, but now in the DMI method the ALLEGATO field is null.
    If I change the encodeInResponse to true, it works.
    But I really need it to false :-)

    #2
    What should work here is to create a new DSRequest in your DMI, so that it not a client request and therefore won't be influenced by encodeInResponse. We do agree however that your explicit "outputs" setting should probably override the encodeInResponse setting, so we'll look at whether this should be fixed such that your existing approach works.

    Comment


      #3
      We fixed this in a way, that binary fields listed in outputs will be available on the server, but still won't be sent to the client accordingly to encodeInResponse=false setting. You may download next (Feb 17) nightly build and try it out. Your original approach should work, but it would be nice to have your confirmation. Thanks!

      Comment


        #4
        SmartClient Version: v10.1p_2016-02-18/Enterprise Deployment (built 2016-02-18)

        I can confirm it's working, thank you very much.

        Comment

        Working...
        X