|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Working with BLOB and etc... |
« View previous topic :: View next topic » |
Author |
Message
|
KoGor |
Posted: Fri Mar 28, 2008 12:53 am Post subject: Working with BLOB and etc... |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
Hi All!
I have a several questions which I hope you could help me to solve! I'm using WMB 6.1 + MQ 6 with last fixes for development on WinXP.
First of all I couldn't manage to refer to specific field in BLOB message. Documentation says:
Quote: |
You can refer to message content using substrings if you know the location of a particular piece of information within the BLOB data. For example, the following expression identifies the tenth byte of the message body:
InputBody.BLOB.BLOB[10]
|
http://publib.boulder.ibm.com/infocenter/wbihelp/v6rxmx/index.jsp?topic=/com.ibm.etools.mft.fp8.doc/ac11640_.htm
I'm confused about using "InputBody" in such way. I used InputRoot instead in Compute node. But when I address BLOB message in such way I have an empty variable. Only when put InputRoot.BLOB.BLOB[1] variable refers to all message, not only first byte. What I did wrong or documentation for all versions WMB is wrong? So now I'm using substring(InputRoot.BLOB.BLOB from 1 for 1) to address specific byte, but anyway I want to understand what is wrong.
The second problem.
I have an input message in binary format.
The first three fields have fixed length, and after them it may be an XML part or just binary data again. It depends on the Type field. So I created message in CWF for this:
Message: Chunk
Fields:
Type - 1 byte - fixed length
Version - 1 byte - fixed length
HeaderSize - 2 bytes - fixed length
ChunkCount - 2 bytes (number of chunks in message) - fixed length
BinData - hexBinary - To EndOfMessage - we don't know yet if it's XML or Binary data. This message I constructed in CWF.
I have to parse field "BinData" in Compute node manually, because we don't know exactly what type of message come. So each of the part - XML or Binary have it's own header also in binary and it's similar to the Chunk above:
DataType - 1 byte - fixed length
DataVersion - 1 byte - fixed length
DataHeaderSize - 2 bytes - fixed length
DataSize - 4 bytes - fixed length
Data - hexBinary
I created simple flow - MqIn-Compute-MqOut.
I want in Compute node convert this BLOB (hexBinary) header (which is the several first bytes of the BinData field ) into Integer to get value of fields (DataType, DataVersion, DataHeaderSize and DataSize ) So now I'm stuck with this task because I don't see any efficient way to solve this problem. Is there an easy way to extract these values to Environment so then I can copy binary code, which contains XML part, into BLOB variable and then use CREATE ... DOMAIN ('XMLNS') PARSE (...) to create a XML message tree from this binary data?
I hope I described my problem clear so any help would be usefull.
Thank you in advance for your help! |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 28, 2008 2:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
#1 InputRoot.BLOB.BLOB is equivalent to InputBody.BLOB
So you had 1 BLOB too many after your InputBody....
#2 Model your message in MRM and declare the rest being a BLOB(hex binary) This should give you easy access to the header fields and allow you to determine the nature of the BLOB.
In the next step you can then use Create Parse....
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
KoGor |
Posted: Fri Mar 28, 2008 3:01 am Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
2 fjb_saper:
Thanks for answers!
#1 May be I wasn't clear enough but the question was not about difference between InputRoot.BLOB.BLOB or InputBody.BLOB. I just want to refer to specific byte in my BLOB: use InputRoot.BLOB.BLOB[10] or InputBody.BLOB[10] to refer to the 10th byte in BLOB.
Is it possible not to use substring (which I belive is not best way to get one byte) and only refer for example to the 10th byte in BLOB array, as it said in documentation. The sample from Docs just do not work for me, not mentioned that there is error in variable name.
#2. Exactly as I've done. But is there way in Compute node with ESQL to convert BLOB bytes to Integer. For example two bytes '06 00' to the integer 6 ? |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 28, 2008 5:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
InputRoot.BLOB.BLOB is not an array. It's a field that of BLOB datatype, which is a string-like datatype. If you want to access individual bytes, you must use substring.
There are no arrays in ESQL, only trees.
You're probably trying way too hard to do things that Broker will already do for you.
Broker will automatically detect if data is XML.
If you post your actual problem at a higher level, maybe we will have some suggestions for a better/easier/more Broker way to do it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|