简体   繁体   English

WSO2 Studio开发人员-数据映射器介体

[英]WSO2 Studio Developer - Data Mapper Mediator

I am trying to create a Data Mapper mediator that converts from XML to JSON. 我正在尝试创建一个Data Mapper介体,该介体将从XML转换为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:

<?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: 这是JSON模式:

{
  "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. 每当我尝试创建从XML代码元素到JSON模式中相应字段的链接时,都会收到错误消息。

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"/>

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. 发现了问题:当我将其导入到Data Mapper图中时,messages元素被解释为Object而不是数组。 Once I changed it to an array, the mapping started working and the issue went away. 将其更改为阵列后,映射开始起作用,问题消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM