Author |
Message
|
mkh |
Posted: Tue Sep 10, 2013 4:35 am Post subject: WMB: How to handle mixed data types(within a field) in WMBv7 |
|
|
Newbie
Joined: 10 Sep 2013 Posts: 5
|
Hello,
Input MRM message has fields each of which comprises of mixed datatypes, for example:
CRDRSP = char(4)+char(15)+binary(20)+char(4)+binary(16)
and that should be represented in the output XML
<CRDRSP>char(4)+char(15)+binary(20)->hex(40)+char(4)+binary(16)->hex(32) </CRDRSP>
How to define in model(MRM-CWF)?
Thank you for your support.
Best regards,
Kazim |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Sep 10, 2013 4:42 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
XML is not designed to hold random strings of bytes in the content of an element as raw bytes.
So, the answer is, you don't. The end result is going to be an unparseable XML document.
Otherwise, the technique is "create a message definition file that contains elements for each field, with the correct properties to allow that definition to parse the document". |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 10, 2013 4:43 am Post subject: Re: WMB: How to handle mixed data types(within a field) in W |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mkh wrote: |
How to define in model(MRM-CWF)? |
As their data types with whatever delimits them (possibly their length).
As to how to represent that in XML, the standard doesn't allow that kind of mixed format so I assume there's some kind of internal standard you need to build _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
exerk |
Posted: Tue Sep 10, 2013 4:51 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Moved to the Message Broker forum... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Sep 10, 2013 4:57 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
The only way to handle this within XML is to hex-encode the field and wrap that result in CDATA.
As mqjeff says, you cannot place non-textual characters inside an XML tag. For example, how would you escape a hex value that corresponds to a reserved XML value? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mkh |
Posted: Tue Sep 10, 2013 5:15 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2013 Posts: 5
|
- I have defined the filed as element of 'xsd:string' and in the compute node: SET OutputRoot.XML."Message" = InputRoot.MRM;
then in the generated output XML message, I see the characters parsed to String(same as sent), but the binary data parsed to special characters(unreadble)
- when defined as 'xsd:hexBinary' the binary data parsed to meaningful output value but the characters are parsed to the values which I do not understand
- when defined CRDRSP as complexType within which 5 local elements of corresponding data types, but following error:
"The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this type" |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Sep 10, 2013 5:16 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mkh wrote: |
- I have defined the filed as element of 'xsd:string' and in the compute node: SET OutputRoot.XML."Message" = InputRoot.MRM;
then in the generated output XML message, I see the characters parsed to String(same as sent), but the binary data parsed to special characters(unreadble)
- when defined as 'xsd:hexBinary' the binary data parsed to meaningful output value but the characters are parsed to the values which I do not understand
- when defined CRDRSP as complexType within which 5 local elements of corresponding data types, but following error:
"The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this type" |
DIDN'T WE JUST SAY WHAT YOU ARE DOING WILL NOT WORK? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 10, 2013 5:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mkh wrote: |
- I have defined the filed as element of 'xsd:string' and in the compute node: SET OutputRoot.XML."Message" = InputRoot.MRM;
then in the generated output XML message, I see the characters parsed to String(same as sent), but the binary data parsed to special characters(unreadble)
- when defined as 'xsd:hexBinary' the binary data parsed to meaningful output value but the characters are parsed to the values which I do not understand |
Yes, 3 people have told you XML can't handle that.
mkh wrote: |
- when defined CRDRSP as complexType within which 5 local elements of corresponding data types, but following error:
"The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this type" |
This implies there's a problem with your message set on the inbound, and even if there wasn't you'd get a CRDRSP tag with 5 children not a single tag with a single value.
You also shouldn't be using the XML domain in the sense of:
Code: |
SET OutputRoot.XML."Message" |
Use XMLNSC. Though this will not help with your impossible problem. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 10, 2013 5:25 am Post subject: Re: WMB: How to handle mixed data types(within a field) in W |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mkh wrote: |
and that should be represented in the output XML
<CRDRSP>char(4)+char(15)+binary(20)->hex(40)+char(4)+binary(16)->hex(32) </CRDRSP> |
Back to first principles - why are you attempting to do this? What's the requirement (and the correct answer is not any variant of "I was told to do this")? What's consuming this XML once you manage to produce it? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mkh |
Posted: Tue Sep 10, 2013 5:32 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2013 Posts: 5
|
another application server (weblogic) reads that XML message
requirement is - WMB should parse the character data as is and binary to be in hex.
- 5 children would not be a problem, target application will read. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 10, 2013 5:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mkh wrote: |
- 5 children would not be a problem, target application will read. |
Then I recommend you do that, and wonder why you didn't in the first place.
I also wonder what in weblogic would have been able to parse the XML without abending if you'd managed to build it as you first intended. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mkh |
Posted: Tue Sep 10, 2013 5:44 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2013 Posts: 5
|
from definition file:
<xsd:element name="CRDRSP">
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="Field1" type="xsd:string">
</xsd:element>
<xsd:element name="Field2" type="xsd:string">
</xsd:element>
<xsd:element name="Field3" type="xsd:hexBinary">
</xsd:element>
<xsd:element name="Field4" type="xsd:string">
</xsd:element>
<xsd:element name="Field5" type="xsd:hexBinary">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Is there anything missing or wrong? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 10, 2013 6:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mkh wrote: |
Is there anything missing or wrong? |
The code tags round your post?
What happens why you try it? Why ask us if it's right when you can test it out & make the determination yourself in a fraction of the time? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mkh |
Posted: Tue Sep 10, 2013 6:41 am Post subject: |
|
|
Newbie
Joined: 10 Sep 2013 Posts: 5
|
runtime exception:
"The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this type" |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue Sep 10, 2013 6:42 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
mkh wrote: |
runtime exception:
"The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this type" |
Wow, that is interesting. What's your plan to fix it ? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
|