Author |
Message
|
DanielSonFocus |
Posted: Wed Aug 03, 2005 7:01 am Post subject: Binary data in XML |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
Hi,
I am sending some binary data in an XML message to be processed by a WBIMB 5 message flow. I started the design of these flows expecting well-formed XML and so im using XML as the message domain... im starting to think that im going to have to use BLOB; i'm hesitant as this requires a bit of a rewrite to my ESQL as i will literary have to attempt to cast the BLOB as CHAR and scrape for the fields im interested in all the while i have to convert the binary data fields to base64. Is there any quick fix to this problem that doesn't involve the application tier having to send the binary data in base64? i noticed that there is a base64Binary data type in the xsd definitions, but i think this is assuming that my binary data should already be in base64 format on the way in. Anyone have any solutions? |
|
Back to top |
|
 |
fschofer |
Posted: Wed Aug 03, 2005 7:09 am Post subject: |
|
|
 Knight
Joined: 02 Jul 2001 Posts: 524 Location: Mainz, Germany
|
|
Back to top |
|
 |
DanielSonFocus |
Posted: Wed Aug 03, 2005 7:18 am Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
no dice Frank... just tried putting the tag with binary data in a CDATA section and the flow debugger throws a "Parser Exception". I put in a CDATA section with plain text and it works fine. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 7:25 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
CDATA has to be mostly parsable by XML.
You need to, for example, base64 encode the binary data, and then put it into the tag. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
DanielSonFocus |
Posted: Wed Aug 03, 2005 7:43 am Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
i figured as much Jeff... do you think it makes more sense to push the binary to base64 conversion up to the application layer(e.g. the various apps accessing my flow) or should i read the message as BLOB and grep for the binary fields in question and do the conversion on my own. I've gotta beleive that this conversion in the flow from BLOB to base64 will reduce throughput. This flow will be hit with a high number of messages all at once at various point throughout the day. What would be the best practice? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 03, 2005 7:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If your flow is defined as accepting XML, and the applications are not sending valid XML, then why is it your problem?
Also, it is not necessarily easy (although I think I'm forgetting something here) to base64 encode or decode within ESQL - you might have to call out to Java to do this. And in that case you may be better off writing a preprocessor program in Java that will sit between the sending apps and your broker. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
DanielSonFocus |
Posted: Wed Aug 03, 2005 8:03 am Post subject: |
|
|
 Apprentice
Joined: 05 Jun 2005 Posts: 35 Location: Louisville, Kentucky
|
thanks for the input... i think you're right, i will ask all the applications accessing my flow to base64 encode any binary data before they send it to me. In addition you're right about base64 conversion in ESQL, you'll need to call an external Java function that performs this logic. I actually am using such a function in my flow right now to encode the inputted message and attach it to the ouput for auditing purposes. Anyway.. thanks again for the input. |
|
Back to top |
|
 |
zpat |
Posted: Wed Aug 03, 2005 8:32 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I recently wrote a z/OS mainframe REXX to Base64 encode data and put it on a MQ queue - I found a freeware assembler program for the encoding - if you want the details send me a PM. There are plenty of other samples for non-mainframes around of course. |
|
Back to top |
|
 |
|