ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere DataPower » Preserving CDATA in a service

Post new topic  Reply to topic
 Preserving CDATA in a service « View previous topic :: View next topic » 
Author Message
rajparekh08
PostPosted: Wed Dec 21, 2011 5:35 am    Post subject: Preserving CDATA in a service Reply with quote

Acolyte

Joined: 21 Sep 2009
Posts: 58
Location: India- Bagalore

Hi,
I have configure a MPGW service, with HTTP as IN and MQ as out.
The aim is to simply send a message to A Mq queue from HTTP. No processing is done, and processing policy contains a match rule, which matches all URL(s) and a Result rule.
Here the input file type is XML . Now my xml has CDATA values in the XML elements. When I specify the Input type as XML in DP, then the Message automatically gets changed, wherein the CDATA is removed, and the value under CDATA get assigned to the element.
If I change the Input type as Pass thru, then the Message goes As-IS.
I want to preserve the CDATA in the message, Is there anyway to do so?
Thanks
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
lancelotlinc
PostPosted: Fri May 18, 2012 1:07 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Whats happening is the DataPower parse function is detecting XML data inside your CDATA tag. Since DataPower is designed to remove threats, it must not only parse your original XML but also the XML inside the CDATA section to see if any threat is posed. This is the default behavior of the DataPower parse function: it builds out the XML in the incoming CDATA tag when is passes the data on through to the back side. You may want to open a PMR or RFE to IBM since it seems reasonable that you want the CDATA preserved and not exploded out into the backside data message. It seems, based on my reading of the IBM docs, that this is the designed behavior. You have a requirement that needs some exception to the designed behavior. I see that others on message boards also have a similar requirement.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Sun May 20, 2012 7:39 pm    Post subject: Re: Preserving CDATA in a service Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

rajparekh08 wrote:
Now my xml has CDATA values in the XML elements. When I specify the Input type as XML in DP, then the Message automatically gets changed, wherein the CDATA is removed, and the value under CDATA get assigned to the element.

That's what an XML parser is supposed to do. CData sections, (like entity or character references), are just another means to escape character data that would otherwise be recognized as markup. The parser un-escapes any character data as it populates the parsed message tree, before handing off the message tree to the MPGW; the parser will re-escape any characters as needed upon output, in order to preserve the correct semantics, but may use entity/character references instead of CData sections.

rajparekh08 wrote:
If I change the Input type as Pass thru, then the Message goes As-IS. I want to preserve the CDATA in the message, Is there anyway to do so?

Either change the Input type to pass-thru or non-XML, or add an xslt transform to indicate which elements should use CData sections upon output.

lancelotlinc wrote:
What's happening is ...

No, that's not what's happening. The XML parser does not look for or parse XML elements inside a CData section (assuming there are any), build them out, or explode them out the backside, nor does XML threat protection require any of that. Anything that changes the underlying semantics of an XML message would require an explicit xslt transform.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon May 21, 2012 6:26 am    Post subject: Re: Preserving CDATA in a service Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

rekarm01 wrote:
lancelotlinc wrote:
What's happening is ...

No, that's not what's happening. The XML parser does not look for or parse XML elements inside a CData section (assuming there are any), build them out, or explode them out the backside, nor does XML threat protection require any of that. Anything that changes the underlying semantics of an XML message would require an explicit xslt transform.


It is possible I did not understand this correctly:

Quote:
If the input XML document includes CDATA sections |with an embedded XML document, the DataPower® parser |removes the CDATA sections and converts the complete input document |to UTF-8, the DataPower internal |data format.


http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fxb60%2Fextensionfunctions56.htm
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Mon May 21, 2012 10:08 am    Post subject: Re: Preserving CDATA in a service Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

lancelotlinc wrote:
It is possible I did not understand this correctly:

Quote:
If the input XML document includes CDATA sections with an embedded XML document, the DataPower® parser removes the CDATA sections and converts the complete input document to UTF-8, the DataPower internal data format.


http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fxb60%2Fextensionfunctions56.htm

This link describes the xslt dp:parse() extension function, which a stylesheet would need to invoke explicitly; this is independent of the XML parser which would provide the input to an MPGW.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere DataPower » Preserving CDATA in a service
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.