Search code examples
oraclesoapxquerycdataosb

Oracle OSB cdata passed to reqest envelope


I have to pass some xml structure into the cdata, which is inserted in soap:Envelope structure. Right now i have some function which generates xml structure:

declare function local:getRequest($bd as element(fml:FML32)) as element (request)
{
<request>
    <requestAttributes>
    ...
    </requestAttributes>
</request>
};  

And when i tried to serialize this data

<soapenv:Body>
<Request>
    <requestId>{data(...)}</requestId>
    <templateList>
        <template>
            <type>{data(...)}</type>
    <data>
        { fn-bea:serialize(fn:concat('<![CDATA[',fn-bea:serialize(local:getRequest($body)),']]>'))} 
    </data>
     </template>
    </templateList>
</Request>
</soapenv:Body>

the result (data visible in destination service) is like this:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header/>
    <soapenv:Body>
        <Request>
            <requestId>...</requestId>
            <templateList>
                <template>
                    <type>...</type>
                    <data>
                        &lt;![CDATA[&lt;tns:request&gt;&lt;requestAttributes&gt;...&lt;/requestAttributes&gt;&lt;/request&gt;]]&gt;
                    </data>
                </template>
            </templateList>
        </Request>
    </soapenv:Body>
</Envelope>

Is there any possibility to get the result like this:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Header/>
    <soapenv:Body>
        <Request>
            <requestId>...</requestId>
            <templateList>
                <template>
                    <type>...</type>
                    <data>
                        <![CDATA[<tns:request><requestAttributes>...</requestAttributes></request>]]>
                    </data>
                </template>
            </templateList>
        </Request>
    </soapenv:Body>
</Envelope> 

How replaced (using xuery) escaped characters andlt; and andgt; to < > ?


Solution

  • Apparently there has been an update to the XPath Expression Editor in the OSB since the editor in 11.1.1.3 now automatically sets the CDATA definition.

    Try:

    {fn-bea:serialize(local:getRequest($body))}
    

    Reference Jan Van Zoggel