Author |
Message
|
mgm |
Posted: Wed Jun 08, 2011 1:58 pm Post subject: How to model a serise of bytes byte-array in a message set |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
I need to model a message type of byte sequence with no delimiters
The message looks like a byte array object in java where
the first 4 bytes are fixed and then a two bytes hex length for the rest of payload then the payload. We must keep the type as byte and don't convert to char.
Below is a dump of byte-array message that we need to model.
Any ideas?
[0, 0, 0, 0, 0, 27, 0, 0, 1, 2, 18, 0, 2, 11, -71, 1, 65, 1, 1, 0, 12, 57, 54, 54, 53, 57, 51, 56, 55, 48, 48, 48, 50] |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 08, 2011 2:17 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Use TDS.
Create a model with three elements:
4-byte fixed length field
2-byte fixed length field
variable length element, with length-encoded by previous field. |
|
Back to top |
|
 |
mgm |
Posted: Wed Jun 08, 2011 3:08 pm Post subject: |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
Thanks a lot for your feedback.
I modeled the format as you pointed but it's not clear how to set values in the message tree, each time I assign value I got parser error |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 08, 2011 8:40 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
mgm wrote: |
Thanks a lot for your feedback.
I modeled the format as you pointed but it's not clear how to set values in the message tree, each time I assign value I got parser error |
Did you specify the correct endianness for the length field?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mgm |
Posted: Thu Jun 09, 2011 1:03 am Post subject: |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
fjb_saper wrote: |
mgm wrote: |
Thanks a lot for your feedback.
I modeled the format as you pointed but it's not clear how to set values in the message tree, each time I assign value I got parser error |
Did you specify the correct endianness for the length field?  |
I tried the Physical Type as text & integer but seems invalid as well |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 09, 2011 4:24 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The correct physical type for the prefixed length is 'Integer'.
Quote: |
I got parser error |
Please take a debug-level user trace and post the *relevant* parts here.
Alternatively, do what I suggested on the DeveloperWorks forum - use the BLOB domain and write a few lines of ESQL to parse the data. The format is so simple that a message set is not really required. |
|
Back to top |
|
 |
mgm |
Posted: Thu Jun 09, 2011 4:31 am Post subject: |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
I have already used ESQL to parse and it works fine.
The issue that I need to use message set because I need to send/receive this byte array sequence through TCP/IP nodes which needs to be configured correctly to read/write data which is not fixed length and not delimited. So having a message set would make it easy for the nodes to correctly send/receive the data.
The other issue that the target TCP/IP server expects the data in byte form and when I used BLOB it sends the hexadecimal values which was not accepted by the server |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 09, 2011 4:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mgm wrote: |
when I used BLOB it sends the hexadecimal values which was not accepted by the server |
That's because you didn't specify a CCSID/encoding. |
|
Back to top |
|
 |
mgm |
Posted: Thu Jun 09, 2011 4:42 am Post subject: |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
mqjeff wrote: |
mgm wrote: |
when I used BLOB it sends the hexadecimal values which was not accepted by the server |
That's because you didn't specify a CCSID/encoding. |
What values should I use here,
Should I use the target server CCSID with MQNative encoding or specify other value |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 09, 2011 4:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mgm wrote: |
mqjeff wrote: |
mgm wrote: |
when I used BLOB it sends the hexadecimal values which was not accepted by the server |
That's because you didn't specify a CCSID/encoding. |
What values should I use here,
Should I use the target server CCSID with MQNative encoding or specify other value |
You should use the values that accurately describe the bytes. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 09, 2011 4:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mgm wrote: |
What values should I use here,
Should I use the target server CCSID with MQNative encoding or specify other value |
The values should describe the inbound data. WMB will deal with the target encoding. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 09, 2011 4:58 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
mgm wrote: |
What values should I use here,
Should I use the target server CCSID with MQNative encoding or specify other value |
The values should describe the inbound data. WMB will deal with the target encoding. |
And yet clearly that's not the case, as mqm has already had issues. |
|
Back to top |
|
 |
mgm |
Posted: Thu Jun 09, 2011 5:04 am Post subject: |
|
|
Apprentice
Joined: 14 Dec 2007 Posts: 48 Location: anywhere
|
Thanks for your support.
I am still working on the message set issue as I need to be able to receive variable length data through TCP/IP node and I have no other way to predict the length. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 09, 2011 5:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You might look at the ISO8583 pattern in the repository here. It does something similar with a TCPIServerInput node followed by a TCPServerRecieve node to read the rest of the data. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 09, 2011 5:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This is getting complex. Please read the following questions carefully, and answer all of them.
Quote: |
The issue that I need to use message set because I need to send/receive this byte array sequence through TCP/IP nodes which needs to be configured correctly to read/write data which is not fixed length and not delimited. So having a message set would make it easy for the nodes to correctly send/receive the data. |
Q1: Are you receiving a large stream of bytes, and splitting it into records using the Parsed Record Sequence option on the TCP/IP node? If so, then that is a good and valid reason for using a message set.
Quote: |
The other issue that the target TCP/IP server expects the data in byte form and when I used BLOB it sends the hexadecimal values which was not accepted by the server |
I don't know what that means. Judging by the other responses, nor does anybody else.
If you use the MRM domain, the MRM parser will write the message tree as as a stream of bytes, and then give it to the TCP/IP subsystem. If you use the BLOB domain then it is already a stream of bytes, so I'm struggling to see where the problem lies.
Q2: What is your message flow actually doing? Is it just passing on the payload of each 'record' to another TCP/IP node without doing anything to it ?
Q3: Did you take the user trace that I asked for? If so, what did it say? |
|
Back to top |
|
 |
|