1

I am trying to create a Data Mapper mediator that converts from XML to JSON. However, whenever I try to create a link, I get the following error message:

!ENTRY org.wso2.developerstudio.datamapper.diagram 2 0 2018-02-22 12:43:29.804
!MESSAGE Could not save file L/X/Y.dmc : java.lang.ArrayIndexOutOfBoundsException

Here's the XML:

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns0:response xmlns:ns0="http://www.server.com/api/SoapEndpoint">
         <return>
            <messages>
               <code>0</code>
               <message>STRING</message>
            </messages>            
         </return>
      </ns0:response>
   </S:Body>
</S:Envelope>

Here's the JSON schema:

{
  "success": true,
  "messages": [
    {
      "code": 0,
      "message": "string"
    }
  ]
}

Whenever I try to create a link from the XML code element to the corresponding field in the JSON schema, I get the error message.

Here's my Data Mapper config portion:

 <datamapper config="gov:datamapper/Y.dmc" inputSchema="gov:datamapper/A.json" inputType="XML" outputSchema="gov:datamapper/Y.json" outputType="JSON"/>
Community
  • 1
  • 1
AMalik
  • 23
  • 4

1 Answers1

0

Found out the issue: when I was importing it into the Data Mapper diagram, the messages element was being interpreted as an Object rather than array. Once I changed it to an array, the mapping started working and the issue went away.

AMalik
  • 23
  • 4