Hi @Matthew Dobson, @santosh_ghalsasi
I am trying to use the JSON2XML plugin available in the edgemicro default plugins to convert a backend response from XML to JSON. However I am getting an error. I tried setting the log level to info but still couldnt get much information about why the error is occuring. I am using Edge Micro version 2.3.3.
Please see the logs for the request I posted:
1488099244531
info sourceRequest m=GET, u=/helloxml/echo, h=localhost:8000, r=::1:60642,
i=201ce430-fc01-11e6-a7a5-9f16a1b8d761
1488099245488 info targetRequest m=GET, u=/xml/echo,
h=mocktarget.apigee.net:null, i=201ce430-fc01-11e6-a7a5-9f16a1b8d761
1488099245504 error json2xml handler threw an exception
1488099245504 error
1488099246171 info targetResponse s=200, d=1640, i=201ce430-fc01-11e6-a7a5-9f16a1b8d761
1488099269675 stats treqErrors=0, tresErrors=0, statusCodes={1=0, 2=1, 3=0,
4=0, 5=0}, requests=1, responses=1, connections=undefined, rss=44785664,
cpu=[5127375, 4924390, 5613343, 7414015]
I am also attaching the config file . Can you help me to find what is the issue?
Regards,
Varun
Solved! Go to Solution.
I found the issue, and a potential fix has been released today. Snuck in last minute 🙂
Please check out using npm install edgemicro@2.4.0-beta
I found the issue, and a potential fix has been released today. Snuck in last minute 🙂
Please check out using npm install edgemicro@2.4.0-beta
I tried out the new version of Edge Micro and the JSON2XML plugin is working fine. Thanks.
Great news. Thanks for the confirmation!
I installed the "current edgemicro version is 2.4.0-beta"
But still json2xml is not working.
My Curl command:
curl --insecure -X POST -H "Accept: Application/json" -H "Content-Type: application/json" -H "x-api-key:ASEDFDJFKSDLFKJH" https://<URL>; -d '{"id":"IDVALUE","name":"Mike"}'.
I am getting the below Error:
e=undefined, stack=TypeError: Cannot read property 'indexOf' of undefined
at onend_response ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/microgateway-plugins/json2xml/index.js:159:19)
at handlerException ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/microgateway-core/lib/plugins-middleware.js:477:23)
at node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:1149:20
at node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:375:13
at iterate ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:262:13)
at Object.async.forEachOfSeries.async.eachOfSeries ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:281:9)
at Object.async.inject.async.foldl.async.reduce ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:374:15)
at node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:1148:19
at node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/async/lib/async.js:166:37
at IncomingMessage.targetResponse.on ( node-v6.10.2-linux-x64/lib/node_modules/edgemicro/node_modules/microgateway-core/lib/plugins-middleware.js:393:5)
The most likely reason is because the response http does not have a content-type set.