Author |
Message
|
Vinayak.Satapute |
Posted: Sat Aug 17, 2013 1:48 am Post subject: Assign CDATA to XML element with attribute value present |
|
|
Acolyte
Joined: 20 Dec 2006 Posts: 70
|
Hi,
I am trying to assign an CDATA field to an XMLNSC element with attribute value present. But I am getting XML writing errors on that XMLNSC element.
Is that CDATA field can not be assigned to an XMLNSC element with an attribute? Is it a limitation in XMLNSC for CDATA?
Sample message as below.
<![CDATA[ <transaction feeder="IN"> <operation> <insertion> <trn_id>IN0001</trn_id> <tick> <flows /> <header Tick_Type="Loan" Facility_ID="106263" Drawdown_Amount="1" Counterparty_UID="20393" Product="100" Branch_Code="000043" Source_System_Counterparty_ID="8030876002" Drawdown_Currency="AED" Product_Subtype="MOTARI LOAN INDIVIDUAL" Product_Type="MOTARI AUTO LOAN" Outstanding_Amt_Local_CCY="1000" Local_Currency="AED" Outstanding_Amt_Exposure_CCY="1000" Outstanding_Balance_CCY="1000.00" Accrued_Interest_Receivable="0" Capitalized_Interest_Due="0" First_Disbursal_Date="12/05/2013"/> </tick> </insertion> </operation> </transaction> ]]]]>
Exception Generated as below :
Text:CHARACTER:Unexpexted XML type at this point in document.
Insert
Type:INTEGER:5
Text:CHARACTER:feeder[IN]
Insert
Type:INTEGER:5
Text:CHARACTER:attributeType
ESQL CODE Map:
Set OutputRoot.XMLNSC.ns1:request.ns1:request.ns1:parameters.ns1:parameter[3].(XMLNSC.CDataField)ns1:transaction = transactionMsgChar;
Appreciate your inputs further.
Thanks,
Vinayak |
|
Back to top |
|
|
dogorsy |
Posted: Sat Aug 17, 2013 2:40 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Can you please format the xml and use the [ c o d e ] tags, both for the xml and the esql ?
and also, is that the expected output or what is being generated ?
Please tell us:
1- Input message
2- Expected output message
3- what is the value of what you are assigning in your code, i.e the value of transactionMsgChar;
Also,
Code: |
I am trying to assign an CDATA field to an XMLNSC |
you are not trying to assign a CDATA field to xmlnsc, you are trying to create CDATA in an xml message. |
|
Back to top |
|
|
Simbu |
Posted: Sat Aug 17, 2013 7:10 am Post subject: Re: Assign CDATA to XML element with attribute value present |
|
|
Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
|
Back to top |
|
|
Vinayak.Satapute |
Posted: Sat Aug 17, 2013 9:38 pm Post subject: |
|
|
Acolyte
Joined: 20 Dec 2006 Posts: 70
|
Hi Simbu,
I have already gone through the link you provided.
Dogorsy,
Can you please format the xml and use the [ c o d e ] tags, both for the xml and the esql ? (I dont understand what you mean by this.)
Expected output message :
*******************************
Code: |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mur="murex.limits.connectivity.communication.soap">
<soapenv:Header/>
<soapenv:Body>
<mur:processRequest>
<mur:in0>
<![CDATA[
<request user="ADMIN" group="FO_ALL_AD" password="00d0003100b000870077" requestId="AB00F12345" operation="DRAFT" timestamp="00000001"
xmlns="http://www.murex.com/risk/controller/connectivity/request"
xmlns:req="http://www.murex.com/risk/controller/connectivity/request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.murex.com/risk/controller/connectivity/request res://murex/limits/connectivity/request/request.xsd">
<parameters>
<parameter name="enginePattern">RTLIM</parameter>
<parameter name="useLatestValidatedEngine">true</parameter>
<parameter name="tickInput">
<![CDATA[
<transaction feeder="IN">
<operation>
<insertion>
<trn_id>IN0001</trn_id>
<tick>
<flows />
<header Tick_Type="Loan" Facility_ID="106263" Drawdown_Amount="1" Counterparty_UID="20393" Product="100" Branch_Code="000043" Source_System_Counterparty_ID="8030876002" Drawdown_Currency="AED" Product_Subtype="MOTARI LOAN INDIVIDUAL" Product_Type="MOTARI AUTO LOAN" Outstanding_Amt_Local_CCY="1000" Local_Currency="AED" Outstanding_Amt_Exposure_CCY="1000" Outstanding_Balance_CCY="1000.00" Accrued_Interest_Receivable="0" Capitalized_Interest_Due="0" First_Disbursal_Date="12/05/2013"/>
</tick>
</insertion>
</operation>
</transaction>
]]]]><![CDATA[
</parameter>
</parameters>
</request>
]]>
</mur:in0>
</mur:processRequest>
</soapenv:Body>
</soapenv:Envelope> |
*****************end********************
*******First ComputNode Mapping:**********
Code: |
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)user = 'ADMIN';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)group = 'FO_ALL_AD';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)password = '00d0003100b000870077';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)requestID = InputRoot.MQMD.MsgId;
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)operation = 'DRAFT';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.Attribute)timestamp = '00000001';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.NamespaceDecl)xmlns = 'http://www.murex.com/risk/controller/connectivity/request';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.NamespaceDecl)xmlns:req = 'http://www.murex.com/risk/controller/connectivity/request';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.ns1:request.(XMLNSC.NamespaceDecl)xsi:schemaLocation = 'http://www.murex.com/risk/controller/connectivity/request res://murex/limits/connectivity/request/request.xsd';
DECLARE I INT 1;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'enginePattern';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'RTLTM';
SET I = I + 1;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'useLatestValidatedEngine';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'true';
SET I = I + 1;
-- SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I] = 'Test';
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[I].(XMLNSC.Attribute)name = 'tickInput';
/* Begin with CDATA Construction
-- External CDATA Construction with respect to <request> tag --
*/
DECLARE ref REFERENCE TO OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[<];
-- DECLARE ref REFERENCE TO OutputRoot.XMLNSC.ns1:request.ns1:parameters;
-- CREATE FIRSTCHILD OF ref AS ref TYPE Name NAME 'transaction';
SET ref.ns1:transaction.(XMLNSC.Attribute)feeder = 'IN';
DECLARE cTrnId CHARACTER;
SET cTrnId = InputRoot.XMLNSC.ns:GetFacilityLimit.ns:ApplicationArea.ns:ContextInfo.ns:TransactionId;
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:trn_id = InputRoot.XMLNSC.ns:GetFacilityLimit.ns:ApplicationArea.ns:ContextInfo.ns:TransactionId;
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:flows = '';
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:header.(XMLNSC.Attribute)Tick_Type= 'Loan';
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:header.(XMLNSC.Attribute)Facility_ID =
InputRoot.XMLNSC.ns:GetFacilityLimit.ns:DataArea.ns:FacilityLimit.ns:GeneralInfo.ns:FacilityID;
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:header.(XMLNSC.Attribute)Counterparty_UID =
InputRoot.XMLNSC.ns:GetFacilityLimit.ns:DataArea.ns:FacilityLimit.ns:GeneralInfo.ns:CounterpartyID;
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:header.(XMLNSC.Attribute)Product =
InputRoot.XMLNSC.ns:GetFacilityLimit.ns:DataArea.ns:FacilityLimit.ns:GeneralInfo.ns:ProductCode;
SET ref.ns1:transaction.ns1:operation.ns1:insertion.ns1:tick.ns1:header.(XMLNSC.Attribute)Branch_Code =
InputRoot.XMLNSC.ns:GetFacilityLimit.ns:DataArea.ns:FacilityLimit.ns:GeneralInfo.ns:BranchCode; |
*************************************
**********2nd Compute Node Transform to CDATA****
Code: |
CREATE PROCEDURE Transform_LASReq_CDATA() BEGIN
DECLARE J INT;
SET J = CARDINALITY(InputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[]);
DECLARE transactionMsgBlob BLOB
ASBITSTREAM(InputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[J].ns1:transaction.ns1:operation,
InputRoot.Properties.Encoding,
InputRoot.Properties.CodedCharSetId );
DECLARE transactionMsgChar CHAR
CAST(transactionMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
DELETE FIELD OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[J].ns1:transaction.ns1:operation;
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[J].ns1:transaction.(XMLNSC.CDataField)ns1:operation = transactionMsgChar;
DECLARE transactionMsgCDATA_Nest CHAR
SET transactionMsgCDATA_Nest = OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[J].ns1:transaction.(XMLNSC.CDataField)ns1:operation;
SET transactionMsgCDATA_Nest = REPLACE(transactionMsgCDATA_Nest,']]>' , ']]><![CDATA[');
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.ns1:parameter[J].ns1:transaction.ns1:operation = transactionMsgCDATA_Nest;
RETURN TRUE; |
*************end 2nd comput node**********
In the above message If I try to create CDATA field for the XML element with attribute value present I get the XML writing errors saying invalid XML input datatype.
for ex if I do the below assignment I get the above mentioned exception:
SET OutputRoot.XMLNSC.ns1:request.ns1:parameters.(XMLNSC.CDataField)ns1:parameter[J] = transactionMsgChar;
****************Sample input message - Plain XML******
Code: |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="http://www.nbad.com/model">
<soapenv:Header/>
<soapenv:Body>
<mod:GetFacilityLimit releaseID="" versionID="" languageCode="en-US" environment="">
<mod:ApplicationArea>
<!--Optional:-->
<mod:Sender>
<!--Optional:-->
<mod:LogicalID></mod:LogicalID>
<!--Optional:-->
<mod:ReferenceID></mod:ReferenceID>
<!--Optional:-->
<mod:ConfirmationCode></mod:ConfirmationCode>
<!--Optional:-->
<mod:AuthorizationID></mod:AuthorizationID>
</mod:Sender>
<!--Zero or more repetitions:-->
<mod:Receiver>
<!--Optional:-->
<mod:LogicalID></mod:LogicalID>
<!--Optional:-->
<mod:ComponentID></mod:ComponentID>
<!--Zero or more repetitions:-->
<mod:ID></mod:ID>
</mod:Receiver>
<mod:CreationDateTime>2013-08-14T00:00:00.000+04:00</mod:CreationDateTime>
<!--Optional:-->
<mod:Signature qualifyingAgencyId="">
<!--You may enter ANY elements at this point-->
</mod:Signature>
<!--Optional:-->
<mod:BODID schemeID="" schemeName="" schemeAgencyID="" schemeAgencyName="" schemeVersionID="" schemeDataURI="" schemeURI=""></mod:BODID>
<mod:ContextInfo>
<mod:ServiceId>11111</mod:ServiceId>
<mod:TransactionDateTime>2013-08-14T00:00:00.000+04:00</mod:TransactionDateTime>
<mod:TransactionTimeZone>AST AbuDhabi,Mustcat</mod:TransactionTimeZone>
<mod:RequiredExecutionDate>2013-08-14</mod:RequiredExecutionDate>
<mod:TransactionId>9FK1000010300001</mod:TransactionId>
<mod:CorrelationId>9FK1000010300001</mod:CorrelationId>
</mod:ContextInfo>
</mod:ApplicationArea>
<mod:DataArea>
<mod:Get uniqueIndicator="" maxItems="" recordSetSaveIndicator="" recordSetStartNumber="" recordSetReferenceId="">
<!--Optional:-->
<mod:TaskID>2</mod:TaskID>
<mod:ChangeStatus>
<!--Optional:-->
<mod:ReasonCode></mod:ReasonCode>
<!--Optional:-->
<mod:ReasonDescription></mod:ReasonDescription>
<!--Optional:-->
<mod:OriginalReasonCode></mod:OriginalReasonCode>
<!--Optional:-->
<mod:OriginalReasonDescription></mod:OriginalReasonDescription>
<!--Optional:-->
<mod:EffectiveDateTime></mod:EffectiveDateTime>
<!--Zero or more repetitions:-->
<mod:Reason>
<!--Optional:-->
<mod:Code></mod:Code>
<!--Optional:-->
<mod:Description></mod:Description>
</mod:Reason>
<mod:SIPFlag>1</mod:SIPFlag>
<mod:SIPDate>2013-08-14T00:00:00.000+04:00</mod:SIPDate>
<!--Optional:-->
<mod:NoOfSegments></mod:NoOfSegments>
<!--Optional:-->
<mod:UserArea>
<!--You may enter ANY elements at this point-->
</mod:UserArea>
</mod:ChangeStatus>
</mod:Get>
<!--1 or more repetitions:-->
<mod:FacilityLimit>
<mod:GeneralInfo>
<mod:FacilityID>106263</mod:FacilityID>
<mod:CounterpartyID>20393</mod:CounterpartyID>
<mod:SourceSystemCounterpartyID>8030876002</mod:SourceSystemCounterpartyID>
<mod:BranchCode>000043</mod:BranchCode>
<mod:ProductCode>100</mod:ProductCode>
<mod:ProductDesc></mod:ProductDesc>
<mod:SubProductDesc></mod:SubProductDesc>
<mod:DrawdownAmount>
<mod:Amount></mod:Amount>
<!--Optional:-->
<mod:Currency></mod:Currency>
</mod:DrawdownAmount>
<mod:DrawdownCurrency>AED</mod:DrawdownCurrency>
<mod:CurrencyRate></mod:CurrencyRate>
<mod:FacilityType></mod:FacilityType>
<mod:TradingDate></mod:TradingDate>
</mod:GeneralInfo>
<mod:AdvancedInfo>
<!--Optional:-->
<mod:ReservationDetails>
<mod:Operation></mod:Operation>
<mod:ReservationID></mod:ReservationID>
<mod:ControllerID></mod:ControllerID>
<mod:Comments></mod:Comments>
<mod:TradingDateTime></mod:TradingDateTime>
<!--1 or more repetitions:-->
<mod:ReservationKey></mod:ReservationKey>
</mod:ReservationDetails>
<!--Zero or more repetitions:-->
<mod:LimitDetails>
<mod:FacilityDimension></mod:FacilityDimension>
<mod:ManagementEntityDimension></mod:ManagementEntityDimension>
<mod:FacilityKey></mod:FacilityKey>
<mod:ManagementEntityKey></mod:ManagementEntityKey>
<mod:Risk></mod:Risk>
<mod:RiskType></mod:RiskType>
<mod:AffectedLimit></mod:AffectedLimit>
<mod:Group></mod:Group>
<mod:ContributionAmount></mod:ContributionAmount>
<mod:TotalPositionAmount></mod:TotalPositionAmount>
<mod:MinAvailableLimit></mod:MinAvailableLimit>
<mod:MaxAvailableLimit></mod:MaxAvailableLimit>
<mod:MinCurrency></mod:MinCurrency>
<mod:MaxCurrency></mod:MaxCurrency>
<mod:MaxExpiryDateTime></mod:MaxExpiryDateTime>
</mod:LimitDetails>
<!--Zero or more repetitions:-->
<mod:Overflows>
<mod:Details></mod:Details>
<mod:Message></mod:Message>
<!--Zero or more repetitions:-->
<mod:TransactionId></mod:TransactionId>
</mod:Overflows>
<!--Zero or more repetitions:-->
<mod:TransactionDetails>
<mod:TransactionId></mod:TransactionId>
<!--Zero or more repetitions:-->
<mod:TransactionFields>
<mod:Field></mod:Field>
<!--Optional:-->
<mod:Value></mod:Value>
</mod:TransactionFields>
</mod:TransactionDetails>
<!--Zero or more repetitions:-->
<mod:FXRates>
<!--Zero or more repetitions:-->
<mod:FXRate>
<mod:Currency></mod:Currency>
<mod:CurrencyRate></mod:CurrencyRate>
</mod:FXRate>
</mod:FXRates>
</mod:AdvancedInfo>
</mod:FacilityLimit>
</mod:DataArea>
</mod:GetFacilityLimit>
</soapenv:Body>
</soapenv:Envelope> |
***************************************
Appreciate your further input.
Thanks,
Vinayak
[modified by admin]inserted code tags[/modified] |
|
Back to top |
|
|
dogorsy |
Posted: Sat Aug 17, 2013 10:51 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Vinayak.Satapute wrote: |
Hi Simbu,
I have already gone through the link you provided.
|
You probably mean you have read the article. But, did you understand what it says ?
Vinayak.Satapute wrote: |
Dogorsy,
Can you please format the xml and use the [ c o d e ] tags, both for the xml and the esql ? (I dont understand what you mean by this.)
|
If you don't understand that, then you don't need to reply to question above. |
|
Back to top |
|
|
dogorsy |
Posted: Sun Aug 18, 2013 12:38 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
dogorsy wrote: |
Vinayak.Satapute wrote: |
Hi Simbu,
I have already gone through the link you provided.
|
You probably mean you have read the article. But, did you understand what it says ?
Vinayak.Satapute wrote: |
Dogorsy,
Can you please format the xml and use the [ c o d e ] tags, both for the xml and the esql ? (I dont understand what you mean by this.)
|
If you don't understand that, then you don't need to reply to question above. |
and, in the Expected output message above, it is not clear whether that is what you want build or what you are building ? |
|
Back to top |
|
|
smdavies99 |
Posted: Sun Aug 18, 2013 12:57 am Post subject: |
|
|
Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
[ C O D E ] tags are in the options presented to you above the window where you type your questions/replied. The make reading bits of code and output a lot easier.
You can go back and edit your posts. Try it and see. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
|
kimbert |
Posted: Mon Aug 19, 2013 7:35 am Post subject: |
|
|
Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Are you setting the field type to XMLNSC.CDataField on a complex element? You can't do that - XMLNSC.CDataField is for simple string fields.
If you want to send the contents of the complex element as a CDATA section, you can
- pre-serialize the sub-tree using ASBITSTREAM, to create a BLOB
- CAST the BLOB to CHARACTER
- Replace the complex element with a CHARACTER element.
- Set XMLNSC.CDataField on the CHARACTER element. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
|
|