Service Virtualization

  • 1.  Issue in base64 decoding.

    Posted Jan 21, 2016 08:10 AM

    Hi All,

     

    I have a Java code (shown below) which decodes the Base64 format messages. This piece of code used to work fine in LISA_7.5 version however, it is giving back weird response in DevTest_8.5. We have currently migrated to DevTest_8.5 from LISA_7.5.

     

    Code:

    import com.itko.lisa.test.TestEvent;

    import com.itko.util.*;

     

    if(testExec.getStateValue("SigRoute_Decode")!=null)

    {

        byte[] decodedString = com.itko.util.Base64.decode(testExec.getStateValue("SigRoute_Decode")); //SigRoute_Decode=H4sIAAAAAAAAAAtJLS4BADLRTXgEAAAA

        decodedXML = new String(decodedString);

        testExec.setStateValue("Decoded_POSResponse", decodedXML);

        return  "Decoded Payload: " + testExec.getStateValue("Decoded_POSResponse");

    }

    else

    {

        testExec.setStateValue("Decoded_POSResponse","");

    }

     

    Response:

    Thanks,

    Uttam.



  • 2.  Re: Issue in base64 decoding.

    Broadcom Employee
    Posted Jan 25, 2016 04:40 PM

    Back in September of 2015, there was a change to Base64 class.

     

    To make it work now, use "decodeAndUnzip" method instead of "decode", see example below:

     

    byte[] decodedString = com.itko.util.Base64.decode(testExec.getStateValue("Payload_Response"));

     

    With

     

    byte[] decodedString = com.itko.util.Base64.decodeAndUnzip(testExec.getStateValue("Payload_Response"));

     

    I am researching to know how these types of changes can get communicated better to customers.