Forum Stats

  • 3,770,379 Users
  • 2,253,100 Discussions
  • 7,875,430 Comments

Discussions

OSB-SOA: Issue with XML Payload tags < and > getting replaced by &lt; and &gt;

Sanket24
Sanket24 Member Posts: 79 Blue Ribbon
edited Feb 1, 2018 7:39AM in SOA Suite Discusssions

Hi All,

We have an XML Request payload to be passed from OSB to SOA which contains CDATA element within a request element as below:

<Details>

  <FirstName></FirstName>

  <LastName></LastName>

  <Others><![CDATA[

  <Element1></Element1>

  <Element2></Element2>

  <Element3></Element3>

  etc.

  ]]></Others>

</Details>

However, when this is received at SOA end and when we use XSLT transformation or Assign activity to assign this payload to the calling target service, the elements within CDATA gets automatically converted as below:

<Details>

  <FirstName></FirstName>

  <LastName></LastName>

  <Others><![CDATA[

  &lt;Element1&gt;some data&lt;/Element1&gt;

  &lt;Element2&gt;some data&lt;/Element2&gt;

  &lt;Element3&gt;some data&lt;/Element3&gt;

  etc.

  ]]></Others>

</Details>

Because of this it gives error stating 'Error in provider endpoint' in our target service. This error may not apply to the actual scenario above but the Issue is we want '<' and '>' rather than '&lt;' and '&gt;'

Could anybody help us resolve this issue?

Could you

Tagged:

Answers

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown
    edited Feb 1, 2018 3:47AM

    Hi Sanket,

    I don't know what steps you take in your composite to achieve this. When the message arrives at SOA, how is the CDATA part represented? And why are those elements in the CDATA construct anyway?

    What happens along the way is apparent double encoding  of the tags. <![CDATA[<aap><noot>mies</noot></aap>]] is exactly the same as &lt;aap&gt;&lt;noot&gt;mies&lt;/noot&gt;&lt;/aap&gt; . So, to get it parsed into xml, you would need to do a double parse-escaped-xml. Somewhere along the way you do an apparent extra escaping. So I would try to trace the updates along the service-execution.  But what you could do, if the message is received correctly in SOA, is to backup the <others> tag content in a separate variable, do your transformations and in the message to target service replace the content with the backed-up varaible.

    Regards,

    Martien

  • Sanket24
    Sanket24 Member Posts: 79 Blue Ribbon
    edited Feb 1, 2018 4:22AM

    Hi Martein,

    Thanks for your reply.

    Actually, when we check the payload in SOA receive activity, the tags are shown as below,

    <Details>

      <FirstName></FirstName>

      <LastName></LastName>

      <Others>

      &lt;Element1>some data&lt;/Element1>

      &lt;Element2>some data&lt;/Element2>

      &lt;Element3>some data&lt;/Element3>

      etc.

      </Others>

    </Details>

    One thing I have observed is that, from SOA the payload assignment is working fine, but when it comes from OSB then we are facing this issue.

    Is there any Bug in OSB that it converts the elements inside CDATA from < > to &lt; and &gt;

    Regards,

    Sanket

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown
    edited Feb 1, 2018 7:39AM

    Hi Sanket,

    I'm not aware of that bug. These things just work for me. It's just something you need to implement with care.

    SOASuite and OSB see an encoded or CDATA enclosed content as a plain string. Actually it is something the XML Parser handles.

    Regards,
    Martien

This discussion has been closed.