Reputation: 13
I am a beginner and any help will be very much appreciated.
I want to set input and output connectors using the GeoEvent manager such that the input side receives text in XML format, and the output connector sends the converted JSON.
Using the manager I have set up a GeoEvent service where I have set the input and output connectors to different ports on the localhost. (Probably not the right way to go about, will try to set up servers and try, however just want to know if it's possible doing this simple way)
For example: input connector: https://[localhost ip]:3000/ (this returns XML)
output connector: https://[localhost ip]:2121/ (This will log the JSON on receiving from the output connector)
I need help in selecting the right connectors (poll XML from an external website or rest endpoint)
Should I make any changes to my js code?
Output connector side: Is the JSON sent in the body of the POST request to the target link?
//-----------XML Side------------
const express = require('express');
const srv = express();
const port = 3000;
let xml = `<note>
<to>Satwik</to>
<from>Harry</from>
<heading>Hi</heading>
<body>Sup, let us catchup.</body>
</note>`
srv.post('/', (req, res) => {
res.set('Content-Type', 'text/xml');
res.send(xml);
});
srv.listen(port);
//----------------JSON Side---------
const express = require('express');
const srv = express();
const port = 2121;
srv.use(express.json());
srv.post('/', (req, res) => {
console.log(req.body);
});
srv.listen(port);
Upvotes: 1
Views: 93