0

I have a written a class mediator to call an endpoint, by using the response from the backend endpoint I am following a JSONArray, converting it into an XML string and setting context property. I am using a payload Factory mediator to format the xml payload and send it to XSLT. But I am getting the below error if I try XSLT transformations.

 The evaluation of the XPath expression xslt-data did not result in an OMNode : null org.apache.synapse.SynapseException: The evaluation of the XPath expression xslt-data did not result in an OMNode : null

But if I use the respond Mediator, I get the proper XML data in response.

Here is my Payload coming from class mediator:

<array>
    <discount>0.0000</discount>
    <locale>en</locale>
    <total_tax>10.8900</total_tax>
    <customer_id>315</customer_id>
    <currency_id>UN</currency_id>
</array>
<array>
    <discount>1.23</discount>
    <locale>un</locale>
    <total_tax>10.45</total_tax>
    <customer_id>316</customer_id>
    <currency_id>USD</currency_id>
</array>

Here's my code payloadFactory formatting:

<payloadFactory media-type="xml">
        <format>
            <data xmlns="">
$1
</data>
        </format>
        <args>
            <arg evaluator="xml" expression="get-property('RESPONSE')"/>
        </args>
    </payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/xml"/>

How can I resolve this error to perform the XSLT transformation? Thanks

Ruby
  • 368
  • 1
  • 9

1 Answers1

0

When you are setting the property try setting the Property type to OM.

<property name="RESPONSE" expression="$body" type="OM" />
ycr
  • 12,828
  • 2
  • 25
  • 45
  • I've tried setting property type as "OM", but that did not work as well. The error I get "com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog" – Ruby Mar 13 '23 at 14:03
  • @Ruby you may have to provide a full example for us to reproduce the issue. – ycr Mar 13 '23 at 14:13
  • From Class mediator, I get xml as a string, is that a problem? But anyways I am setting a property as application/xml, but that doesn't work – Ruby Mar 13 '23 at 14:28
  • 1
    Its a large flow, I'll try to update the ticket with as much info as possible – Ruby Mar 13 '23 at 14:29