I have an API that will return XML data, I want to use datamapper to map some data and then return it to the client, but the API after using DataMapper keeps returning null.
see below
<?xml version="1.0" encoding="UTF-8"?>
<api context="/AllAdByCRN" name="AllAdByCRN" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope format="soap11" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<GetCustomerWaselNotCancelled xmlns="http://tempuri.org/">
<userName></userName>
<password></password>
<id></id>
<idType></idType>
<sequenceNumber></sequenceNumber>
<laborOffice></laborOffice>
</GetCustomerWaselNotCancelled>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<header name="Action" scope="default" value=""/>
<call>
<endpoint>
<http format="soap11" method="post" uri-template="">
<timeout>
<duration>17000000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<property expression="json-eval($.*)" name="responseData" scope="default" type="STRING"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<datamapper config="gov:datamapper/NewConfig.dmc" inputSchema="gov:datamapper/NewConfig_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/NewConfig_outputSchema.json" outputType="XML" xsltStyleSheet="gov:datamapper/NewConfig_xsltStyleSheet.xml"/>
<log level="custom">
<property expression="json-eval($.*)" name="responseData"/>
</log>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
I want to map data only not converting from XML to JSON.
You have to choose XML as input and output :
<datamapper config="gov:datamapper/NewConfig.dmc" inputSchema="gov:datamapper/NewConfig_inputSchema.json" inputType="XML" outputSchema="gov:datamapper/NewConfig_outputSchema.json" outputType="XML" xsltStyleSheet="gov:datamapper/NewConfig_xsltStyleSheet.xml"/>