Note prior message will not view correctly on Web as the escaped data gets interpreted and un-escaped. Appears OK in an email.
-----Original Message----- From: kimhorn [mailto:[email protected]] Sent: Wednesday, 15 April 2009 2:29 PM To: [email protected] Subject: Does CData work ? We have a target service that requires a CDATA wrapped tag as the text can have leading and/or trailing spaces. I have attemped to use a Java Mediator to wrap the data, in a property, with CData. The property is then imbedded into XML payload using Javascript, see below. Extract of Java: claimData = "<![CDATA[\"" + claimData + "\"]]>"; synCtx.setProperty("claimData", claimData); Note the " are required to delimit the data for the receiver. However using TCPMON the data actually sent is: <ws1:responseFormat>997</ws1:responseFormat> <ws1:claimData><![CDATA["000000221933601MOHMCRYBA000000022193 etc etc ...... The recipient service does not like this. Synapse escapes the "<" . I was hoping to get: <ws1:responseFormat>997</ws1:responseFormat> <ws1:claimData><![CDATA["000000221933601MOHMCRYBA000000022193 etc etc ...... It appears betwen the mediator and send, the XML gets weird. After the mediator I am using JavaScript to add the property into the XML payload, see {claimData}: <script language="js"><![CDATA[var guid = mc.getProperty("GUID").toString(); var claimData = mc.getProperty("claimData").toString(); var fileName = mc.getProperty("fileName").toString(); mc.setPayloadXML(<ws1:submitHealthCareClaimBatch xmlns:ws1="http://ws1.thelma.icsglobal.net"> <ws1:guid>{guid}</ws1:guid> <ws1:clientBatchId>{guid}</ws1:clientBatchId> <ws1:claimFormat>NDC</ws1:claimFormat> <ws1:responseFormat>997</ws1:responseFormat> <ws1:claimData>{claimData}</ws1:claimData> </ws1:submitHealthCareClaimBatch>); ]]></script> Is the Javascript the problem ? Note it is impossible to insert the CDATA in the Javascript as then the Javscript become invalid due to the nested CDATA. Hence why I used Java. If I do all the above in Java, create the payload in Java and wrap the tag in "<![CDATA[\"" + claimData + "\"]]>" in Java, instead of Javascript, is this likely to work, or is it the synapse send process escaping the CDATA XML ? Thanks Kim -- View this message in context: http://www.nabble.com/Does-CData-work---tp23052352p23052352.html Sent from the Synapse - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
