Pentaho

 View Only
  • 1.  HOW TO decode CDATA block from Carte's API reply?

    Posted 17 days ago

    Hi,

    I am requesting data to Carte's API and I cannot decode the /jobstatus/logging_string XPATH

    It looks like this:
    xmllint.exe popo.xml -xpath /jobstatus/logging_string |head


    <logging_string>&lt;![CDATA[H4sIAAAAAAAAAOy9a5PbNtY1+v38Cn44H5KqoZv3i6s8VXa32u48fZtWO868qSkVRVKOMmpJj6RO
    4nnr/PcDkBRFUgC5QWzQ7rFcUxPFIdYCNvbeABZIwDIs68w0z0xPM4LXhvHaNTRdu5+M316PxpOL
    aBeNvyxj8lfjXbTZaauZ9vtqqqV/pfHzbr5a/j+WUPn58rOWLnebL9qv48k43U3uN6s43W4nP0eb
    eTRdpNt/SSHOn9aLdDL6I1o8R7R6k/NoscCFlED7qXjEMMunJjer5YoF6ZLyvOfJf/q4pbib56UW
    r5az+efnTVY57dd7whX9ttIWqzhitrwDuFnnx8Oj16vP8+Xk7f3VEaxJ/kfKsp7tX9d20Ifn5ZLC
    7jbRcjtbbZ5yzOeMa/dbqv1Putst0oOnkgaR0qkYy8V8u4528W8UdEstkyYaIWuyCllpPHmfLlNi
    [...]

    [...]
    75bz6aVlgfez6V2T8s7vvyyjzX8Dcqa7jS0p9Lvi6I1CuICBkoDY1JXeb1MYxIC7FReJSYDVRaEf
    CxnfDXBEwxGMjoHKohCPf8qyTY99cO3Plzf71SZthHLWG2RnPTOiRB+67BmD4aB8JIv+Qe58NcWI
    PC/CfIj/DyjBgP3MPg36f/8fvSlBCUeWDAA=
    ]]&gt;</logging_string>


    An example can be found here Developer center

    Hitachi Vantara Lumada and Pentaho Documentation remove preview
    Developer center
    Integrate and customize Pentaho products, as well as perform highly advanced tasks. These sections are best used by software engineers who are very familiar with programming concepts and have ...
    View this on Hitachi Vantara Lumada and Pentaho Documentation >



    <jobstatus>
    <jobname>dummy_job</jobname>
    <id>a4d54106-25db-41c5-b9f8-73afd42766a6</id>
    <status_desc>Finished</status_desc>
    <error_desc/>
    <logging_string><![CDATA[H4sIAAAAAAAAADMyMDTRNzTUNzRXMDC3MjS2MjJQ0FVIKc3NrYzPyk8CsoNLEotKFPLTFEDc1IrU5NKSzPw8Xi4j4nRm5qUrpOaVFFUqRLuE+vpGxhKj0y0zL7M4IzUFYieybgWNotTi0pwS2+iSotLUWE1iTPNCdrhCGtRsXi4AOMIbLPwAAAA=]]></logging_string>
    <first_log_line_nr>0</first_log_line_nr>
    <last_log_line_nr>20</last_log_line_nr>
    <result>
    <lines_input>0</lines_input>
    <lines_output>0</lines_output>
    <lines_read>0</lines_read>
    <lines_written>0</lines_written>
    <lines_updated>0</lines_updated>
    <lines_rejected>0</lines_rejected>
    <lines_deleted>0</lines_deleted>
    <nr_errors>0</nr_errors>
    <nr_files_retrieved>0</nr_files_retrieved>
    <entry_nr>0</entry_nr>
    <result>Y</result>
    <exit_status>0</exit_status>
    <is_stopped>N</is_stopped>
    <log_channel_id/>
    <log_text>null</log_text>
    <result-file/>
    <result-rows/>
    </result>
    </jobstatus>


    Any idea which decoding tool should I be using?
    I have tried base64 but I don't know if I am missing something.


    Thanks for your time

    Best regards



    ------------------------------
    Juan Sierra Pons
    Systems Engineer
    Juan Sierra Pons
    ------------------------------


  • 2.  RE: HOW TO decode CDATA block from Carte's API reply?
    Best Answer

    Posted 16 days ago
    Hi Juan,
    it is gzip stream encoded by base64. So decode via base64 and deflate via gzip. First 10 bytes of decoded stream is 1f8b0800000000000000.

    ------------------------------
    Petr Prochazka
    Systems Engineer
    P.V.A. systems s.r.o.
    ------------------------------



  • 3.  RE: HOW TO decode CDATA block from Carte's API reply?

    Posted 16 days ago

    Attaboy!

    @Petr Prochazka thanks for your time and sharing your knowledge

    echo H4sIAAAAAAAAADMyMDTRNzTUNzRXMDC3MjS2MjJQ0FVIKc3NrYzPyk8CsoNLEotKFPLTFEDc1IrU5NKSzPw8Xi4j4nRm5qUrpOaVFFUqRLuE+vpGxhKj0y0zL7M4IzUFYieybgWNotTi0pwS2+iSotLUWE1iTPNCdrhCGtRsXi4AOMIbLPwAAAA= |base64 -d | gunzip

    2014/11/17 07:13:20 - dummy_job - Start of job execution
    2014/11/17 07:13:20 - dummy_job - Starting entry [DUMMY]
    2014/11/17 07:13:20 - dummy_job - Finished job entry [DUMMY] (result=[true])
    2014/11/17 07:13:20 - dummy_job - Job execution finished​


    BTW I was almost there: https://jira.pentaho.com/browse/PDI-10309?jql=text%20~%20%22CDATA%22

    ------------------------------
    Juan Sierra Pons
    Systems Engineer
    Juan Sierra Pons
    ------------------------------