Posted: Tue May 13, 2014 1:41 am Post subject: Embed XML as encoded String within XML
Centurion
Joined: 13 May 2014 Posts: 121
Hi,
I have a requirement wherein I need to embed an xml within an xml to generate a SOAP request. Inside xml has to be inserted as String. The structure looks something like -
I tried casting the inner xml to String and then using the XMLNSC parser as below -
Code:
DECLARE OutputMessageBlob BLOB;
SET OutputMessageBlob = ASBITSTREAM OutputRoot.XMLNSC.hris:Dispatch.hris:HRXML);
DECLARE OutputMessageChar CHARACTER CAST(OutputMessageBlob AS CHARACTER CCSID 1208);
CREATE LASTCHILD OF Environment.Variable.Data DOMAIN ('XMLNSC') PARSE (OutputMessageChar CCSID 1208);
SET OutputRoot.XMLNSC.hris:Dispatch.hris:HRXML = Environment.Variable.Data;
This doesnt give me the encoded string as expected. I am missing the entities '&it' and '>' in the generated xml.
You're just dealing with Output trees (OutputRoot etc). You're not referencing any Input trees in the ESQL.
I think you need to do something more like:
Code:
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.hris:HRXML = CAST(InputRoot.BLOB.BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
If you only need part of the InputRoot.XMLNSC, you can either ASBITSTREAM it and then cast it using the input CCSID.
I'm assuming here you've defined namespaces for soapenv and hris beforehand. _________________ Regards
John
The pain of low quaility far outlasts the joy of low price.
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