Today I was working in developing Web Services in Siebel and I realized that I need to send an XML message embedded in a SOAP envelope. When I was testing it I realized that Siebel did not like the special characters inside the xml elements because the parser had special meaning to it and would either ignore or error it.
For example:
I was sending an XML message as one of the Property Sets for a workflow which will be later interpreted using Integration object. So I inserted an xml message inside an SOAP element hoping that Siebel would consider that as string of characters. But it considered that as having a special meaning. My partial SOAP envelope is below.
<cus:IncomingXML>
<OpportunityBase>
<Name>t40174</Name>
<Contact>
<FirstName>Robert</FirstName>
<LastName>DCosta</LastName>
</Contact>
<OpportunityBase>
</cus:IncomingXML>
Where the element IncomingXML contains one of the input propertysets in the workflow. When Siebel receives this message it would parse the entire XML and not ignore the special characters.
To avoid having parser to understand that there is an embedded xml message inside the xml element we enclose the message inside a CDATA (Character Data) block like in the below case. When the parser sees the CDATA, it understands that as an actual message and not to parse it.
<cus:IncomingXML>
<![CDATA[
<OpportunityBase>
<Name>t40174</Name>
<Contact>
<FirstName>Robert</FirstName>
<LastName>DCosta</LastName>
</Contact>
<OpportunityBase>
]]>
</cus:IncomingXML>
This way the actual message wont be altered. Notice that the CDATA section starts with “<![CDATA[” and ends with “]]>“
Using CDATA we can also send functions, javascript, URLs etc. I believe that CDATA is used very often..
Also keep in mind that the message enclosed inside CDATA cannot contain “]]>” and nested CDATA is not allowed.
I am not an expert in web services yet and as I am still exploring the web services world, this is could be a very basic tip but still useful. Let me know what you think. Post your comments.
Related posts(Auto Generated):





March 17th, 2009 at 11:14 am
This tip is of great use.
I faced quite similar problem where I had to pass i/p to business service ,invoked using Business Simulator. The input data was like ” Trace (xyz)”; The parser treated this input as some kind of fuction and the simulation failed. I guess use of CDATA could have worked!