Friday 5 May 2017

Request passing between Java server and Node server

I have a Java server (WebSphere server) and a node server are running on a machine. From Java server's JSP, I am doing a GET request to node server for some process. This request contain some authorization details which is set by Websphere server itself.

I am getting all the GET parameters in Node server which are sent by Websphere server.

For a part of requirement, I want to forward that request from node server to another stand alone web dynamic project, which is deployed on java server(websphere server) and exposed as a servlet. Web project is doing stuff that requires same request object which is send by JSP.

I tried

app.runMiddleware(url, function (code, body, headers) {
    console.log("")
    res.status(code).send(body)
  })

And

 var options = {
      host: host,
      port: port,
      path: path,
      method: 'GET',
      headers: req.headers
    };

    http.request(options, function (res) {
      res.setEncoding('utf8');
      res.on('data', function (chunk) {
        console.log('BODY: ' + chunk);
      });
    }).end();

I tried run-middleware using express, request.redirect features of NodeJs but no luck. I am new at nodeJs.



via parth.hirpara

No comments:

Post a Comment