App Connect

 View Only
Expand all | Collapse all

DFDL To ISO Conversion

  • 1.  DFDL To ISO Conversion

    Posted Thu September 02, 2021 02:05 PM
    Hi Team,

    In my project, We are getting JSON from client and our requirement is to convert that JSON into ISO and send that ISO Message to TCP/IP Node.

    We are using DFDL for converting JSON to ISO.

    We have created the DFDL model and imported that as library in my project.

    In my compute Node, I am setting values for few fields in DFDL.

    But that DFDL value is not serialized into ISO while moving out from my Compute Node.

    Is there any document or sample code available for converting the JSON to ISO  and how to serialize the output of DFDL?




    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------


  • 2.  RE: DFDL To ISO Conversion

    Posted Thu September 02, 2021 05:43 PM
    We do not have any doc showing how to perform this conversion.  Your steps look correct.  I'm guessing the the DFDL values you are setting are incorrectly placed in the tree and thus ignored.  For instance, if there is an array but you do not include "Item" in the path, DFDL will not recognize the element as being part of the array.

    Without your sample data and ESQL code, it is hard to make a guess.

    Serialization occurs on output, or you can use the ASBITSTREAM method within the flow to serialize on demand.

    If you need additional assistance, please open a case and provide your project with ESQL code and your sample message.

    ------------------------------
    MATTHEW SEGALL
    ------------------------------



  • 3.  RE: DFDL To ISO Conversion

    Posted Fri September 03, 2021 12:20 AM
    Hi Matthew,

    Thanks for the reply!!

    Below is my code

    CREATE COMPUTE MODULE JSONmesssageflow_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber = InputRoot.JSON.Data.PrimaryAccountNumber_002;
    SET OutputRoot.DFDL.ISO8583_1987.AmountTransaction = InputRoot.JSON.Data.AmountTransaction_004;
    SET OutputRoot.DFDL.ISO8583_1987.AmountSettlement = InputRoot.JSON.Data.AmountSettlement_005;
    RETURN TRUE;
    END;
    END MODULE;

    I am expecting the ISO Message from this code to next node. But the output is still a tree structure. I am not sure why its not serialized when going to the next node.


    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------



  • 4.  RE: DFDL To ISO Conversion

    Posted Fri September 03, 2021 08:54 AM
    Like any node to node interaction, a message tree is passed.  As stated previously, serialization only occurs when outputting the message or when ASBITSTREAM is called.  There is nothing in your code which would trigger a serialization.  Thus the next node should be getting a message tree.  If you want the serialized form, use:
    CREATE COMPUTE MODULE JSONmesssageflow_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
       SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber = 
          InputRoot.JSON.Data.PrimaryAccountNumber_002;
       SET OutputRoot.DFDL.ISO8583_1987.AmountTransaction = 
          InputRoot.JSON.Data.AmountTransaction_004;
       SET OutputRoot.DFDL.ISO8583_1987.AmountSettlement = 
          InputRoot.JSON.Data.AmountSettlement_005;
       CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB');
       SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL);
       DELETE FIELD OutputRoot.DFDL;
       RETURN TRUE;
    END;
    END MODULE;​

    We use BLOB as this is a stream of hex data, the serialized message form.  We then convert the DFDL message into BLOB with ASBITSTREAM which causes the serialization.  Lastly, we delete the DFDL message tree so that there is only one body in our message.



    ------------------------------
    MATTHEW SEGALL
    ------------------------------



  • 5.  RE: DFDL To ISO Conversion

    Posted Fri September 03, 2021 10:27 AM
    Hi Mathew 
    Tried this approach but getting below error

    The PIF data could not be found for the specified application

    Code:
    CREATE COMPUTE MODULE JSONmesssageflow_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    SET OutputRoot.Properties.MessageType = '{ISO8583}:ISO8583_1987.xsd';
    SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber = InputRoot.JSON.Data.PrimaryAccountNumber_002;
    SET OutputRoot.DFDL.ISO8583_1987.AmountTransaction = InputRoot.JSON.Data.AmountTransaction_004;
    SET OutputRoot.DFDL.ISO8583_1987.AmountSettlement = InputRoot.JSON.Data.AmountSettlement_005;
    CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB');
    --CREATE LASTCHILD OF InputRoot DOMAIN('DFDL') PARSE(InputRoot.BLOB.BLOB ENCODING InputRoot.Properties.Encoding CCSID InputRoot.Properties.CodedCharSetId TYPE '{}:ISO8583_1987');
    SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL);
    DELETE FIELD OutputRoot.DFDL;
     RETURN TRUE;
    END;
    END MODULE;

    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------



  • 6.  RE: DFDL To ISO Conversion

    Posted Fri September 03, 2021 11:45 AM

    On this line:
    SET OutputRoot.Properties.MessageType = '{ISO8583}:ISO8583_1987.xsd';

    Remove .xsd so it looks like:
    SET OutputRoot.Properties.MessageType = '{ISO8583}:ISO8583_1987';

    It is looking for a message called ISO8583_1987.xsd which does not exist.  This is the file name.  The message name is just ISO8583_1987.



    ------------------------------
    MATTHEW SEGALL
    ------------------------------



  • 7.  RE: DFDL To ISO Conversion

    Posted Mon September 06, 2021 02:11 AM
    Edited by Pierre Richelle Mon September 06, 2021 02:14 AM
    Hello SELVAKUMAR,

    <Sorry the previous post didn't shown up when replying. Matthew already answered...>

    When Matthew says that it it serialised on the output, he means when it is sent out using HTTP, MQ, or other nodes.
    If you want to force the serialisation in the flow you need to use either a reset content descriptor  node with message domain set to BLOB or use the ESQL function as Matthew mentioned (ASBITSTREAM):
    SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL.YourMessage OPTIONS RootBitStream);


    ------------------------------
    Pierre Richelle
    IBM Hybrid Cloud Integration Specialists
    IBM
    +32474681892
    ------------------------------



  • 8.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 02:51 AM
    Hi Matthew & Pierre,

    Tried with the solution you have mentioned. But no luck. Still getting same error

    Please find the code and error for your reference

    CREATE COMPUTE MODULE isomessageflow_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    SET OutputRoot.Properties.MessageType = '{ISO8583}:ISO8583_1987';
    SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber = '443';
    SET OutputRoot.DFDL.ISO8583_1987.AmountTransaction = '43';
    CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB');
    SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL);
    --DELETE FIELD OutputRoot.DFDL;
    RETURN TRUE;
    END;
    END MODULE;

    Thanks for your support!!

    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------



  • 9.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 04:20 AM
    Edited by Steve Hanson Tue September 07, 2021 04:42 AM
    Assuming you are using the example ISO8583 schemas from IBM, the ISO8583 1987 model does not have a namespace.  Try:

    SET OutputRoot.Properties.MessageType = '{}:ISO8583_1987';

    Also, the DFDL message you are creating is not correct, as you are:
    a) not creating the MTI_ fields
    b) not creating the bitmap(s) and setting the bits for the fields that exist
    c) the field names are wrong (eg, 'PrimaryAccountNumber' should be 'PrimaryAccountNumber_002'.)

    If you are not using the ISO8583 schemas from IBM, you should use them - they are supplied as a Tutorial in IIB/ACE.

    ------------------------------
    Steve Hanson
    DFDL Architect
    IBM UK
    Winchester
    ------------------------------



  • 10.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 06:23 AM
    Hi Steve,
    Thanks for the reply. I am using IBM ISO 8583 scheme only.I have tried setting the missing fields. But no luck. Please find my code


    CREATE COMPUTE MODULE isomessageflow_Compute
    CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
    --SET OutputRoot.Properties.MessageType = '{ISO8583}:ISO8583_1987';
    --SET OutputRoot.Properties.MessageSet = '{ISO8583}';
    SET OutputRoot.Properties.MessageType = '{}:ISO8583_1987';
    SET OutputRoot.DFDL.ISO8583_1987.MTI_Version = 1;
    SET OutputRoot.DFDL.ISO8583_1987.MTI_MessageClass = 1;
    SET OutputRoot.DFDL.ISO8583_1987.MTI_MessageFunction = 1;
    SET OutputRoot.DFDL.ISO8583_1987.MTI_MessageOrigin = 1;
    SET OutputRoot.DFDL.ISO8583_1987.PrimaryBitmap.Bit002 = 1;
    SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber_002 = '443';
    CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB');
    SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL);
    --DELETE FIELD OutputRoot.DFDL;
    RETURN TRUE;
    END;
    END MODULE;



    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------



  • 11.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 08:30 AM
    Hello,

    I think that the error might due to the fact that you have created two "body" of the root tree before calling the asbitstream.

    You should:

    SET OutputRoot.DFDL.ISO8583_1987.PrimaryAccountNumber_002 = '443';
    -- CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB');
    SET OutputRoot.BLOB.BLOB = ASBITSTREAM(OutputRoot.DFDL);

    DELETE FIELD OutputRoot.DFDL;


    ------------------------------
    Pierre Richelle
    IBM Hybrid Cloud Integration Specialists
    IBM
    +32474681892
    ------------------------------



  • 12.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 08:47 AM
    Hi Pierre,
    Thanks for the reply.

    After adding  message set my problem got resolved. I created simple project for dfdl to csv. There also I faced same problem after adding message set only problem resolved. I tried the same solution with ISO it worked here also.

    SET OutputRoot.Properties.MessageSet = '{ISO8583}';

    Thank you MATTHEW, STEVE, PIERRE for helping me to resolve this issue.

    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------



  • 13.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 11:02 AM
    Ah - so you were using a shared library, called 'ISO8583'. If only you had said :)

    ------------------------------
    Steve Hanson
    DFDL Architect
    IBM UK
    Winchester
    ------------------------------



  • 14.  RE: DFDL To ISO Conversion

    Posted Tue September 07, 2021 11:18 AM
    Yes, you are correct Steve. I am using shared library

    ------------------------------
    SELVAKUMAR ANANTHARAJ
    ------------------------------