wso2数据映射器失败

时间:2016-07-14 06:09:07

标签: wso2 wso2esb wso2carbon

当我尝试使用数据映射器中介时,我总是收到错误。我尝试将json响应映射到xml。

IEnumerator WaitForRequest(string url)
{

    UnityWebRequest www = UnityWebRequest.Get(url);
    www.SetRequestHeader("Cache-Control", "max-age=0, no-cache, no-store");
    www.SetRequestHeader("Pragma", "no-cache");

    yield return www.Send();
    if (www.isError)
    {
        Debug.Log(www.error);
    }
    else
    {
        Debug.Log("Received " + www.downloadHandler.text);
    }
}

这是我的api。我只是用omdbapi来举个例子。

[2016-07-14 14:05:26,684] ERROR - omdbapi DataMapper mediator : mapping failed
XML not well-formed. Error occurred while processing start element event
    at org.wso2.carbon.mediator.datamapper.engine.input.readers.XMLReader.read(XMLReader.java:97)
    at org.wso2.carbon.mediator.datamapper.engine.input.InputModelBuilder.buildInputModel(InputModelBuilder.java:52)
    at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:59)
    at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:244)
    at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:209)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:49)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:160)
    at org.apache.synapse.rest.Resource.process(Resource.java:320)
    at org.apache.synapse.rest.API.process(API.java:336)
    at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:120)
    at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:100)
    at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:55)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:541)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:179)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:252)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:1)

如果您要映射JSON-> XML,您需要在Data Mapper Mediator配置中指定。 确保将输入类型设置为JSON。

在wso2 esb上发布了beta2版本。因此,请尝试使用针对esb runtimetooling的beta2包。使用最新的包并尝试。