Author |
Message
|
pottas |
Posted: Wed Jun 18, 2008 6:52 am Post subject: Converting XMLNSC string to base64Binary |
|
|
 Disciple
Joined: 27 Oct 2005 Posts: 185 Location: South Africa
|
Guys,
I am running WMB 6.1.
I need to cast an XMLNSC input message to base64Binary.
I have tried the ESQL (quoted below) that's in the broker help files, but it returns the exact BLOB string back to me... ('0102030405060708090A0B0C0D0E0F').
Code: |
DECLARE Base64Data BLOB '0102030405060708090A0B0C0D0E0F';
-- Add in the base64Binary field type
DECLARE base64FieldType INTEGER XMLNSC.Field + XMLNSC.base64Binary;
CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';
CREATE LASTCHILD OF OutputRoot.XMLNSC TYPE base64FieldType NAME 'myBinaryData' VALUE Base64Data;
|
...so I need to get the ESQL to convert from either a BLOB to base64Binary, or from the InputRoot.XMLNSC straight to base64Binary.
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 18, 2008 8:22 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have tried the ESQL (quoted below) that's in the broker help files, but it returns the exact BLOB string back to me |
That's the correct behaviour. The code which you are using is changing the field type of 'myBinaryData'. It is not changing the value.
However when the message hits an output node, that logical value will be converted to base64, and will appear as a base64 string in the output XML.
Other users have been confused by this, so I'll try to get that topic updated. |
|
Back to top |
|
 |
chrisc |
Posted: Sun Jun 22, 2008 8:27 pm Post subject: |
|
|
Voyager
Joined: 19 Mar 2006 Posts: 77
|
Just in case you're unsure why the value didn't change (and sorry if this is stating the obvious) - a BLOB string is base64 encoded. That's why the result you're seeing is exactly the same as what you passed in. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jun 23, 2008 12:38 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
chrisc said:
Quote: |
a BLOB string is base64 encoded |
That's just plain wrong. When you say 'a BLOB string' I presume you are talking about a string representation of some bytes. You can convert a string of bytes to a string of characters in any number of ways. In message broker, if you CAST a BLOB to a string, you will get something which looks like xs:hexBinary. That is what pottas was seeing. base64Binary is a different, slightly more efficient encoding. |
|
Back to top |
|
 |
pottas |
Posted: Mon Jun 23, 2008 4:31 am Post subject: |
|
|
 Disciple
Joined: 27 Oct 2005 Posts: 185 Location: South Africa
|
kimbert,
Thanks - makes sense what you said - I tested it by putting the Msg to a queue and it really did change the data to base64 format. Quite nifty!
pottas |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jun 23, 2008 5:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Good - I'm glad somebody has found a use for that.
The topic update has been processed, so it will appear in the online docs at some point in the future. |
|
Back to top |
|
 |
|