spring - Java web application node integration issue -


i having web application sending request node.js. node module calling spring rest module. my web application node call below

$.ajax({          type : "post",          url : "http://localhost:9090/module",          datatype : 'json',          data : msgdetails,          xhrfields : { withcredentials : true },          success : function(data) {         console.log("getinbox" + json.stringify(data.message));   }, error : function(data) {         alert("error in ajax response." + data);   } }); 

my node below

var express = require("express"),  app = express(),  http = require("http").createserver(app);  var requestobj = require('request');   responsebody = ""; indexresponsebody = null; app.use(express.bodyparser());  app.post('/module', function(req, res){     var tempinbox = "";     var tmp = req;     var authkey = req.body.pubkey;     var reqbody = req.body;     console.log("post"+" - "+json.stringify(reqbody)+" - "+authkey);     restcmcall("http://ip:port/restmodule/controller/call", req, res,authkey,reqbody);     //res.end(json.stringify(body));     res.header('content-type', 'application/json');     //resp.header('charset', 'utf-8');     res.send({"name1":"name"}); });   function restcmcall(resturl, req, res, authkey,reqbody){ var = 0; console.log("reqbody :- "+reqbody+" resturl "+resturl+" "+i++); requestobj({     url : resturl,     method : "post",     headers : { "content-type" : "application/json","pubkey":authkey},     body : json.stringify(reqbody) }, function (error, resp, body) {     tempinbox = body;     console.log(resp+" inbox body :- "+"   -------- "+i++);     //resp.writehead(200, {'content-type':'application/json','charset':'utf-8'});     //res.write(json.stringify({"hello":"xxx"}));       //res.end(json.stringify(body));     res.header('content-type', 'application/json');     //resp.header('charset', 'utf-8');     res.send(body); } );     console.log(i++); } 

till able response spring module , able print on node console. when trying add response in response of request made web application not sent.

in firefox browser firebug shows

response headers connection  keep-alive content-length  21 content-type    application/json date    mon, 07 oct 2013 16:13:38 gmt x-powered-by    express 

but response tab blank.

i using express module call spring rest web service calls node.js.

please let me know if missing anything. have tried using

response.json(body) 

but not working.

i believe should making request url : "http://localhost:9090/getinbox" because have not created endpoint in node app matches post: /module


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -