Topic
  • 4 replies
  • Latest Post - ‏2017-11-29T13:28:03Z by j929120
j929120
j929120
3 Posts

Pinned topic How to decode a base64-encoded EBCDIC-XML?

‏2017-11-24T16:59:06Z | base64 binary datapower ebcdic

Hello,

 

I'm trying desperately to decode a base64-URL-encoded String, which contains an EBCDIC-XML-Document (codepage 1141) in MPGW, but neither found a solution with gatewayscript nor with xslt. Has someone a recipe how to do it?

 

The INPUT of the transaction in MPGW contains a non-XML-String with the base64-URL-encoded EBCDIC-XML-String, the OUTPUT to the backend should be a XSD-scheme validated XML-Document  in EBCDIC (like <xml version="1.0" encoding="cp1141">). I tried different ways of decoding with decode and binary-decode, but never got the desired result. I can't try anything with ffd-files because there is no DataGlue license.

 

I'm happy about every idea!

 

Regards and a nice weekend

Updated on 2017-11-24T17:05:08Z at 2017-11-24T17:05:08Z by j929120
  • HermannSW
    HermannSW
    8687 Posts

    Re: How to decode a base64-encoded EBCDIC-XML?

    ‏2017-11-24T18:10:55Z  

    Hi,

    slides 12-14 of this WSTE webcast show how you can parse ebcdic encoded XML in DataPower:
    http://www-01.ibm.com/support/docview.wss?uid=swg27022979&aid=3#page=12

    Now you have to decode your base64 string as pure ebcdic for input into above parse transform action.

    You can do that eg. with "base64Binary" type <dp:output-mapping>
    http://www-01.ibm.com/support/docview.wss?uid=swg27022977&aid=3#page=7

    or with GatewayScript:
    https://www.ibm.com/developerworks/community/forums/html/topic?id=b032ad8b-5ec8-4363-ae3c-82f7e2d60904#3d29d10b-beaf-43ab-841f-04afa42efa37

    Hermann.

     

    Updated on 2017-11-24T18:11:35Z at 2017-11-24T18:11:35Z by HermannSW
  • j929120
    j929120
    3 Posts

    Re: How to decode a base64-encoded EBCDIC-XML?

    ‏2017-11-24T21:21:54Z  

    Hi Hermann,

     

    thank you very much for your quick reply. I've read the WSTE webcast many times before, but I think I still didn't get the "trick".

     

    If I try to decode the base64 by xlst, I get the error mentioned in the first post: mpgw (...): request [...] #3 xform: Transforming the content of PIPE. The transformation local:///....xsl is applied. The results are stored in PIPE. failed: Fatal Error at local:///....xsl: The appliance does not support the DataGlue feature.

    If I try the GatewayScript solution you refered to, I don't get back my encoded bytes. For example, I send a string "1234", in EBCDIC (hex notation) "F1 F2 F3 F4". After decoding with GatewayScript, I get something like this: "ef bf bd ef bf bd ef bf bd ef bf bd"

     

    And at least, if I skip this step and try the EBCDIC solution from the webcast with manually generated data, I get the DataGlue error again.

  • HermannSW
    HermannSW
    8687 Posts

    Re: How to decode a base64-encoded EBCDIC-XML?

    ‏2017-11-27T15:40:50Z  
    • j929120
    • ‏2017-11-24T21:21:54Z

    Hi Hermann,

     

    thank you very much for your quick reply. I've read the WSTE webcast many times before, but I think I still didn't get the "trick".

     

    If I try to decode the base64 by xlst, I get the error mentioned in the first post: mpgw (...): request [...] #3 xform: Transforming the content of PIPE. The transformation local:///....xsl is applied. The results are stored in PIPE. failed: Fatal Error at local:///....xsl: The appliance does not support the DataGlue feature.

    If I try the GatewayScript solution you refered to, I don't get back my encoded bytes. For example, I send a string "1234", in EBCDIC (hex notation) "F1 F2 F3 F4". After decoding with GatewayScript, I get something like this: "ef bf bd ef bf bd ef bf bd ef bf bd"

     

    And at least, if I skip this step and try the EBCDIC solution from the webcast with manually generated data, I get the DataGlue error again.

    Hi,

    for executing Non-XML stylesheets in DataPower (executed in a "Transform Binary" action, with either <dp:input-mapping> or <dp:output-mapping> or both) you need DataGlue license.

    You can either pay for it and use the solution I described.

    Or you can solve your original task using GatewasScript (GatewayScript is available on all DataPowers).
    I just blogged on how you can do what you want in this blog posting:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/Howto_adapt_ICU_code_page_conversion_for_GatewayScript


    DataPower XML processing supports all encodings suppoerted by ICU lib as mentioned earlier.

    This shows that nodejs can be enabled to work with ICU library:
    https://github.com/nodejs/node/wiki/Intl

    You may want to create a Request For Enhancement (RFE) to enable ICU encoding support in GatewayScript:
    https://www.ibm.com/developerworks/rfe/execute?use_case=changeRequestLanding&BRAND_ID=181&PROD_ID=694

    Please provide the github link if you do so.


    Hermann.

  • j929120
    j929120
    3 Posts

    Re: How to decode a base64-encoded EBCDIC-XML?

    ‏2017-11-29T13:28:03Z  

    Hi Hermann,

    Thank you so much for the GatewayScript example. I put that part together with my existing GatewayScript and it works perfectly. To make it more easy the next times, I created a RFE as recommended by you  ( http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=113632 ).