client.js 561 B

123456789101112131415161718192021
  1. var querystring = require('querystring');
  2. var request = require('request');
  3. request({
  4. url: "http://vps.colobu.com:9981/",
  5. method: "POST",
  6. headers: {
  7. 'Content-Type': 'application/rpcx',
  8. // 'X-RPCX-MessageID': '12345678',
  9. // 'X-RPCX-MesssageType': '0',
  10. 'X-RPCX-SerializeType': '1',
  11. 'X-RPCX-ServicePath': 'Arith',
  12. 'X-RPCX-ServiceMethod': 'Mul'
  13. },
  14. body: '{"A":10, "B":20}'
  15. }, function (error, response, body) {
  16. if (!error && response.statusCode == 200) {
  17. console.log(body);
  18. }
  19. });