Author |
Message
|
lancelotlinc |
Posted: Tue Jan 15, 2013 11:08 am Post subject: WMB Message Transformation Theory |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Prompted by this thread:
http://www.mqseries.net/phpBB2/viewtopic.php?t=63210&start=30
I thought I might write about what I know in regards to how Message Broker works. My information is limited to my experience, kimbert, mqjeff, vitor and rekarm01 certainly are invited to correct my statements.
1. Any WMB Input node is waiting to receive a bitstream on an input. This might be from an MQ queue, a file on disk, or a network port.
2. When a message, file, or network I/O arrives, WMB uses the rules defined by the input node to de-serialize this stream into a tree, as illustrated here:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac00520_.htm
Quote: |
A parser is a program that interprets the physical bit stream of an incoming message, and creates an internal logical representation of the message in a tree structure. The parser also regenerates a bit stream for an outgoing message from the internal message tree representation. The message flow nodes provide an interface to query, update, or create the content of the tree. |
3. Various Compute nodes, mapping nodes, and other kinds of nodes are provided by WMB to manipulate the message tree.
4. At some point, the progression of execution of a message flow encounters an output node, at which time the chosen parser serializes the message tree according to rules defined by that parser into a bitstream that is sent out to the destination device, either an MQ queue, file, or network port.
5. The input nodes have no way to invent or create content. They depend on the incoming bitstream to provide the content and value of the incoming data structure. If a required field is missing, the input nodes do not create that data or tag in the message tree automatically.
6. The output nodes have no way to invent or create payload content, except as defined by their rules, which for example, in the SOAP nodes, would be a SOAP envelope. If an XSD defines a specified tag-value and that value is not contained in the message tree, the SoapReply node does not create any data to conform to the XSD requirement of the service contract.
7. Output nodes, like the SoapReply node, do not have the auto-magic capability to transform data from one format to the other, for example, from a string data type to a date data type. Compute nodes - or some other nodes - must perform the type conversion prior to the message tree hitting the output node. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 15, 2013 12:07 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
maybe there should be an addendum to point 7:
Output nodes, in accordance with the parsers and due to the specificity of the expected data, may translate some output into a formatted type of the equivalent XML/Soap category... (thinking about xsd:date, numbers, etc...).
And as Kimbert so nicely corrects me, it is not the output node but the parser. The timing just happens to be at the output node  _________________ MQ & Broker admin
Last edited by fjb_saper on Tue Jan 15, 2013 12:55 pm; edited 2 times in total |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 15, 2013 12:47 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I think this is a useful exercise, and most of your first attempt is true. However, I'd hate to disappoint you, so here are some clarifications/corrections:
Quote: |
2. ...as illustrated here: |
The link is pointing at the wrong topic. This topic and its subtopics would be better: http://publib.boulder.ibm.com/infocenter/wmbhelp/v8r0m0/topic/com.ibm.etools.mft.doc/ac00495_.htm
Quote: |
WMB uses the rules defined by the input node to de-serialize this stream into a tree |
Correct. And those 'rules' always include using the parser associated with the domain specified on the Input node.
Quote: |
5. The input nodes have no way to invent or create content. They depend on the incoming bitstream to provide the content and value of the incoming data structure. If a required field is missing, the input nodes do not create that data or tag in the message tree automatically. |
Mostly true, but the XMLNSC parser ( also used by the SOAP nodes ) does apply default values for missing XML attributes and empty tags when parsing. The DFDL parser is likely ( in a future release ) to apply default values to zero-length elements, because the DFDL specification says that it should.
Quote: |
The output nodes have no way to invent or create payload content |
The DFDL parser supplies default values for missing simple elements when writing. The MRM parser has been doing so for some years now.
Quote: |
Output nodes, like the SoapReply node, do not have the auto-magic capability to transform data from one format to the other, for example, from a string data type to a date data type. |
The output nodes do not have this capability, but the MRM and DFDL parsers will both attempt to 'do the obvious thing' when the data type in the message tree is different from, but convertible to, the data type in the message model. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jan 15, 2013 12:56 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
kimbert wrote: |
If a required field is missing, the input nodes do not create that data or tag in the message tree automatically. Mostly true, but the XMLNSC parser ( also used by the SOAP nodes ) does apply default values for missing XML attributes and empty tags when parsing. The DFDL parser is likely ( in a future release ) to apply default values to zero-length elements, because the DFDL specification says that it should. The output nodes have no way to invent or create payload content. The DFDL parser supplies default values for missing simple elements when writing. The MRM parser has been doing so for some years now. |
If an XSD requires a tag-value (ie. Min 1 Max 1) and a SoapRequest node receives the message tree to send to the downstream provider, does the XMLNSC parser add that tag and content to the outgoing payload even if the message tree has no representation of it?
My guess would be no, however, your comments lead my question...
From my experience, the result would be a validation exception since the message tree does not contain the required tag. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 15, 2013 1:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Reading Kimbert's previous post the expected response would be:
IT DEPENDS. Did you also specify a default value for that tag?
Did you specify create from default in your message model?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 15, 2013 1:02 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
lancelotlinc wrote: |
From my experience, the result would be a validation exception since the message tree does not contain the required tag. |
Does that experience include a missing mandatory tag which includes a default in the xsd? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jan 15, 2013 1:11 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Here's an example:
Code: |
<xs:element name="toEffectiveDate" type="xs:string" minOccurs="1"/> |
No default is specified in the XSD. A value in the format of yyyy-MM-dd-tzoffset is expected by the downstream provider. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
NealM |
Posted: Tue Jan 15, 2013 1:11 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
A very minor point on the wording of statement #4; Not all message flows use output nodes. But then, the only flows germane to this discussion are those that do.... |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 15, 2013 1:15 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
lancelotlinc wrote: |
Here's an example:
Code: |
<xs:element name="toEffectiveDate" type="xs:string" minOccurs="1"/> |
No default is specified in the XSD. A value in the format of yyyy-MM-dd-tzoffset is expected by the downstream provider. |
Please note the type as defined as xsd:string and not xsd:date with a format...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jan 15, 2013 1:16 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
lancelotlinc wrote: |
Here's an example:
Code: |
<xs:element name="toEffectiveDate" type="xs:string" minOccurs="1"/> |
No default is specified in the XSD. |
Then it can't make something up.
If there is default value, however. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jan 15, 2013 1:19 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
@fjb_saper: Yes, correct. Providing any characters in the string that do not conform to yyyy-MM-dd-tzoffset will result in a Fault message being returned by the downstream.
@mqjeff: Please clarify "If there is..." _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
NealM |
Posted: Tue Jan 15, 2013 1:23 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Quote: |
Providing any characters in the string that do not conform to yyyy-MM-dd-tzoffset will result in a Fault message |
So, is the downstream provider using a different .xsd than you for the same message, or is this defect just in his internal logic? Seems like this just complicates the discussion. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jan 15, 2013 1:25 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
NealM wrote: |
Quote: |
Providing any characters in the string that do not conform to yyyy-MM-dd-tzoffset will result in a Fault message |
So, is the downstream provider using a different .xsd than you for the same message, or is this defect just in his internal logic? Seems like this just complicates the discussion. |
The theoretical point is, when a tag-value is required, kimbert says the MRM, XMLNSC, and DFDL parsers will provide the tag and the value if none exist in the message tree.
From my experience, this is not true. If I send a message tree to the SoapRequest node with a missing tag, the XMLNSC parser does not provide the tag or value. The validation throws an exception. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 15, 2013 1:42 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - here is the law of defaulting in message broker. I'll try to be 100% clear this time.
Parsing
- XMLNSC follows the XML rules in the W3C specification to the letter. So...
- XMLNSC defaults missing attributes if they have a default value defined in the XSD
- if a tag is entirely omitted from the input document, XMLNSC does not supply a default, even if the XSD defines a default value
- if a tag is present in the input document with empty content AND the XSD defines a default value, then XMLNSC will use the default value.
- When parsing MRM defaults nothing
- When parsing, DFDL currently defaults nothing ( WMB v8 FP1 ) That could change one day because the DFDL specification says that elements should be defaulted when they are present but 'empty'.
Writing
- XMLNSC does not apply default values. It simply writes the contents of the message tree.
- DFDL defaults missing simple elements.
- MRM defaults missing simple elements if they are in a complex type or group with Data Element Separation set to 'Fixed Length'.
Hope that clears it up. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Jan 15, 2013 1:45 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Yes, thank you. I know that was somewhat of a pain to go through that. But it helps everyone understand what is automatic and what is not. Thanks again. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|