Author |
Message
|
ashrain |
Posted: Mon Mar 21, 2011 7:17 am Post subject: Converting XML Data to BLOB |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Hi All, i need to decode the cdata section and sent the xml as blob.Any help please .Input message is
<?xml version="1.0"?>
<IBISMSG version="1.1">
<SYSHEADER>
<SERVICEID>tst2.testg</SERVICEID>
<TO>~~~~~~~~.~~~~~~~~~~~~</TO>
<FROM></FROM>
<MESSAGEGROUP>N</MESSAGEGROUP>
<MESSAGESEQ>000009</MESSAGESEQ>
<LASTMESSAGEGROUP>N</LASTMESSAGEGROUP>
<OUTTIMESTAMP>2011-03-18 16:22:09</OUTTIMESTAMP>
<UNIQUEID>20110321115809514071</UNIQUEID>
</SYSHEADER>
<APPDATA>
<APPHDR>
<MARKER>JFK</MARKER>
</APPHDR>
<CLIENT/>
<![CDATA[AUpGS0YzMTIgDQouV0FTVUNDUiBTRg0KAkZTTg0KICAgRlgNCiAgIC0gICAgICAgIC1INTQ0Nzg1OTU1DQpDU04vU1ItMS8NCgMNCg==]]>
</APPDATA>
</IBISMSG> |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 21, 2011 8:01 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to write ESQL or Java to access the value of the CDATA Section.
Then similar code to decode it using whatever method has been used to encode it. |
|
Back to top |
|
 |
ashrain |
Posted: Mon Mar 21, 2011 8:06 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
hello..I'm able to decode it now..but I need to send the message as blob data..please find below the esql :
--copy the entire message
CALL CopyEntireMessage();
DECLARE oleRef REFERENCE TO OutputLocalEnvironment.Variables;
DECLARE envRef REFERENCE TO Environment.Variables;
-- Switch Business service Id
CALL SwitchBSID(InputRoot.XML.IBISMSG.SYSHEADER.SERVICEID,envRef);
SET OutputRoot.XML.IBISMSG.SYSHEADER.SERVICEID = envRef.BSID.ABS_ID_OUT;
--route the message to the correct instance of quantum using the BSID
SET OutputLocalEnvironment.Destination.RouterList.DestinationData.labelName = envRef.BSID.ABS_ID_OUT;
DECLARE decodeChar CHAR InputRoot.XML.IBISMSG.APPDATA.(XML.CDataSection);
DECLARE base64Blb BLOB base64Decode(decodeChar);
SET OutputRoot.XML.IBISMSG.APPDATA.(XML.CDataSection) = base64Blb;
DECLARE inputData BLOB CAST (OutputRoot.XML AS BLOB CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding) ;
--SET OutputRoot.BLOB.BLOB = inputData;
CREATE LASTCHILD OF OutputRoot DOMAIN('BLOB') PARSE(inputData);
RETURN TRUE;
END; |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 21, 2011 8:25 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You are trying to cast the field value of the OutputRoot.XML element.
This is not the same thing as the whole tree.
You SHOULD NOT be using the XML domain at all. |
|
Back to top |
|
 |
ashrain |
Posted: Mon Mar 21, 2011 8:31 am Post subject: |
|
|
Novice
Joined: 16 Mar 2011 Posts: 12
|
Any help please..how should I proceed with the esql.thank you in advance...  |
|
Back to top |
|
 |
paintpot |
Posted: Mon Mar 21, 2011 8:48 am Post subject: |
|
|
Centurion
Joined: 19 Sep 2005 Posts: 112 Location: UK
|
Try creating the body with PARSE, if it is valid XML
If it is not, then you will need to explain your data and constraints more |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Mar 21, 2011 8:50 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
change your entire flow so it uses XMLNSC and not XML.
Change your CAST statement to something that works to serialize the tree rather than working with the root parser element of it.
There are probably 100 different threads in this forum that specifically discuss this. |
|
Back to top |
|
 |
|