ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB XML to fixed length Text DFDL is not padding characters?

Post new topic  Reply to topic Goto page 1, 2  Next
 IIB XML to fixed length Text DFDL is not padding characters? « View previous topic :: View next topic » 
Author Message
junaid
PostPosted: Thu Nov 29, 2018 9:55 pm    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

Hi,
I have a requirement in which conversion of xml to text which is fixed. The DFDL Test Serialize model is padding character if length is less than specified length of field. When running flow after mapping padding character is not showing. If in xml field value is hello after padding should be helloAAAAAAAAA .
but after mapping no any padchar is coming

Regards,
JA
Back to top
View user's profile Send private message
junaid
PostPosted: Thu Nov 29, 2018 9:58 pm    Post subject: code of dfdl and mapping Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

I am using IIB developer version 10. issue posted here too.
https://developer.ibm.com/answers/questions/482701/view.html
Following is DFDL and Mapping

Code:
<?xml version="1.0" encoding="UTF-8"?><mappingRoot xmlns="http://www.ibm.com/2008/ccl/Mapping" domainID="com.ibm.msl.mapping.xml" domainIDExtension="mb" mainMap="true" targetNamespace="gen" version="8.0.5.0" xmlns:map="gen">
    <input path="/TFTest_InlineSchema1.xsd"/>
    <output path="/aaaa.xsd"/>
    <namespaces>
        <namespace kind="supplement" prefix="in" uri="http://TFTest"/>
        <namespace kind="extension" prefix="xs" uri="http://www.w3.org/2001/XMLSchema"/>
    </namespaces>
    <generation engine="xquery"/>
    <mappingDeclaration name="TF_Request_Response_Mapping3">
        <input namespace="http://TFTest" path="mb:msg(TF,assembly,XMLNSC,Properties)" var="ComIbmMessageAssembly_TF"/>
        <output path="mb:msg(aaaa,assembly,DFDL,Properties)" var="ComIbmMessageAssembly_aaaa"/>
        <local>
            <input path="$ComIbmMessageAssembly_TF/TF"/>
            <output path="$ComIbmMessageAssembly_aaaa/aaaa/body"/>
            <move>
                <input path="IBANORACCOUNT" var="IBANORACCOUNT"/>
                <output path="body_elem1"/>
            </move>
            <move>
                <input path="BANKIMD"/>
                <output path="body_elem2"/>
            </move>
        </local>
    </mappingDeclaration>
</mappingRoot>


Code:
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ibmDfdlExtn="http://www.ibm.com/dfdl/extensions" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:recFixLengthFieldsFmt="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat">

    <xsd:import namespace="http://www.ibm.com/dfdl/RecordFixLengthFieldFormat" schemaLocation="IBMdefined/RecordFixLengthFieldFormat.xsd"/>
    <xsd:annotation>
      <xsd:appinfo source="http://www.ogf.org/dfdl/">
         <dfdl:format encoding="windows-1252" escapeSchemeRef="" occursCountKind="fixed" ref="recFixLengthFieldsFmt:RecordFixLengthFieldsFormat"/>
      </xsd:appinfo>
   </xsd:annotation>

   <xsd:element dfdl:lengthKind="delimited" ibmSchExtn:docRoot="true" name="aaaa">
      <xsd:complexType>
         <xsd:sequence dfdl:separator="%CR;%LF;%WSP*;" dfdl:separatorSuppressionPolicy="anyEmpty">
            <xsd:element dfdl:lengthKind="delimited" name="body">
               <xsd:complexType>
                  <xsd:sequence>
                     <xsd:element dfdl:length="14" dfdl:lengthUnits="characters" dfdl:textPadKind="padChar" dfdl:textStringJustification="right" dfdl:textStringPadCharacter="A" dfdl:textTrimKind="none" ibmDfdlExtn:sampleValue="llnnn" name="body_elem1" type="xsd:string"/>
                     <xsd:element dfdl:length="14" dfdl:lengthUnits="characters" dfdl:textPadKind="padChar" dfdl:textStringPadCharacter="A" dfdl:textTrimKind="none" ibmDfdlExtn:sampleValue="body_valu2" name="body_elem2" type="xsd:string"/>
                  </xsd:sequence>
               </xsd:complexType>
            </xsd:element>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>


</xsd:schema>
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 30, 2018 1:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Thanks - excellent problem statement.

First thing to point out is...the mapping is not relevant here. The DFDL parser does not know or care how the message tree (OutputRoot.DFDL) was built. The only inputs are the message tree and the DFDL schema.

It would be useful if you could do the following:
1. Insert a Trace node before the output node. Pattern should be set to {Root} and destination set to 'User Trace' .
2. Run the scenario in the DFDL Test perspective and capture the DFDL Trace for elem1 and elem2.
3. Deploy the message flow, switch on debug-level user trace and test the flow with the same values for elem1 and elem2. The user trace will contain the same information as the DFDL Trace (at least, it should do).
Extract the DFDL Trace for elem1 and elem2 from the user trace.

Compare the DFDL Test and user trace versions.
Back to top
View user's profile Send private message
junaid
PostPosted: Fri Nov 30, 2018 5:57 am    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

When sending dfdl output to TCPclientOUtstream node it is giving padded characters. on server which is receiving IIB client request because on bit stream it is padding . I need to know Can I handle it in java compute.

some snapshots are attached in following links
https://stackoverflow.com/questions/53535917/wsdl-to-fixed-text-conversion-is-not-padding-character-in-iib.
https://developer.ibm.com/answers/questions/482701/view/
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 30, 2018 6:59 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

OK - I have read the threads on the other 2 forums. I now understand your problem.

Basically, you have a gap in your understanding of how IIB works. You expected the output of the Mapping node to apply the padding. That is a wrong assumption - the Mapping node works on the logical message tree. It simply takes the input message tree and creates an output message tree.
But the Mapping node does not use the DFDL schema at all.

When the message tree arrives at an output node (e.g. the TCPIPClientOutput node, or a FileOutput node, or... ) the DFDL parser will be invoked and the message tree will be converted into a stream of bytes.

Next step is for you to explain what your requirement is. Do want to
a) create the output bit stream inside the JavaCompute node (as a Java byte array)
or
b) create a message tree with the padded values for elem1 and elem2?
Back to top
View user's profile Send private message
junaid
PostPosted: Fri Nov 30, 2018 12:06 pm    Post subject: Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

Thanks for reply . I say I have both of these requirement periority wise I want to select a) from your given options i.e. java compute
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 30, 2018 1:27 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

OK. It would be unusual to have both of those requirements in the same message flow. Normally padding is a requirement of the output format. If the padding exists in the logical message tree it tends to get in the way.

Anyway...

To achieve a) you need to use the MbElement.toBitstream method. See other posts in this forum for examples.

To achieve b), use the ESQL string manipulation functions or manipulate the values in Java if you prefer. But I would advise you to think very carefully about why you need padded values in the message tree.
Back to top
View user's profile Send private message
junaid
PostPosted: Sun Dec 02, 2018 9:17 pm    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

Thanks I have achieved it through toBitStream.
Quote:
But I would advise you to think very carefully about why you need padded values in the message tree.
For this I have to say that. I am new to IIB nearly 3 weeks before I started IIB. Previously I have worked on other ESB. We have some JavaCode which gets fixed message and apply some logic and give response in string. The need of string with padded values is for this.. Any way many thanks, lot of knowledge gained from here.
Regards,
JA


Last edited by junaid on Sun Dec 02, 2018 9:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
junaid
PostPosted: Sun Dec 02, 2018 9:18 pm    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

Used some of following links
http://www.mqseries.net/phpBB/viewtopic.php?t=32770&sid=99e7ff7177f9cd0379dbe5f627d95d3f
http://www.mqseries.net/phpBB/viewtopic.php?t=40521&sid=65cc4272cad9b3be9ac32489623cdf64
http://www.mqseries.net/phpBB/viewtopic.php?t=50558&sid=c9993d1234a59fcfe8b954d1a9ab083c
http://www.mqseries.net/phpBB/viewtopic.php?t=72806&postdays=0&postorder=asc&start=15
Back to top
View user's profile Send private message
timber
PostPosted: Mon Dec 03, 2018 7:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
Previously I have worked on other ESB. We have some JavaCode which gets fixed message and apply some logic and give response in string
I guessed that. IIB encourages you (the developer) to separate the handling of data formats (parsing, writing, padding etc) from the mapping/filtering/routing of the data in the message.
It's not weird - this is exactly what the DOM tree does for XML applications. You just have to get used to it, and stop trying to handle data format issues in Java code.
Back to top
View user's profile Send private message
junaid
PostPosted: Mon Dec 03, 2018 9:03 pm    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

In java code, It takes fixed length message and makes another sign on message which also fixed and send sign on message with length to socket server . when it receives response of sign on message then, actual message fixed message sent to socket server with length & receives response in fixed text. ... .. that is scenario . We do not want to use TCP nodes of IIB as code is already written in java. No I am stuck how to parse that in Java comput response for mapping .
Back to top
View user's profile Send private message
timber
PostPosted: Tue Dec 04, 2018 1:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
We do not want to use TCP nodes of IIB as code is already written in java
It's your project, but that sounds like a questionable decision to me. If it was me, I would at least try using the TCPIP nodes in IIB.
Quote:
Now I am stuck how to parse that in Java compute response for mapping
If you used the TCPIP nodes then you would not have this problem - you could just set the Domain property on the TCPIPClientRequest node to 'DFDL'.
If you are determined to continue with using Java, take a look at MBElement.createElementAsLastChildFromBitstream.
Back to top
View user's profile Send private message
junaid
PostPosted: Tue Dec 04, 2018 2:31 am    Post subject: IIB XML to fixed length Text DFDL is not padding characters? Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

We have tried TCPIP nodes. but when comparing with java code . it first writes length in byte and secondly writes actual message like
Code:
 bout.write(func(sign_on));
 bout.write((sign_on).getBytes());

public static byte[] func(String paramString)
     {
      
    int i = paramString.length();
    byte[] arrayOfByte = new byte[2];
    arrayOfByte[0] = (byte)(i / 256);
    arrayOfByte[1] = (byte)(i % 256);
      
       return arrayOfByte;
     }


same as when receiving as

Code:
byte msg_len[] = new byte[2];;
int len = (bin.read(msg_len, 0, 2));


so we have 2 nodes for TCPClientOutputClient for signOn Message and 2 node TCPRecieve for and same as for actual message in single connection. so we have 8 nodes of TCP in a flow which is not seems good as flow is going to complex.
Back to top
View user's profile Send private message
junaid
PostPosted: Tue Dec 04, 2018 2:54 am    Post subject: IIB DFDL Validation not performed using mapping node Reply with quote

Acolyte

Joined: 29 Nov 2018
Posts: 58

THIS IS IRRELATED TO PREVIOUS POSTS.
----------------------------------------------
Consider,
we have one DFDL xsd with certain validations(max:length). Validation performed very well when check through DFDL testers(Test Parse $ serialize). Once we use same DFDL in message flow with node "Mapping" for certain transformation, values are passed to the respective datum but WHY VALIDATION(max: Length not checked) not performed ???
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 04, 2018 5:28 am    Post subject: Re: IIB DFDL Validation not performed using mapping node Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

junaid wrote:
THIS IS IRRELATED TO PREVIOUS POSTS.
----------------------------------------------
Consider,
we have one DFDL xsd with certain validations(max:length). Validation performed very well when check through DFDL testers(Test Parse $ serialize). Once we use same DFDL in message flow with node "Mapping" for certain transformation, values are passed to the respective datum but WHY VALIDATION(max: Length not checked) not performed ???

The validation will only be checked or performed if you specify a check with a validation node or serialize the data, which happens when the flow hits an output node. There is not check on the mapping node...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB XML to fixed length Text DFDL is not padding characters?
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.