Posting xml to a url in nodejs
问题 I am developing a client program to hit a post url and get the response from it Below is my code var http = require('http'); var fs = require('fs'); var postData = "<?xml version = '1.0' encoding = 'utf-8'?><REST><Contact>aa</Contact></REST>"; fs.readFile('SampleData.xml', 'utf8', function (err, fileData) { if (err) { return console.log(err); } else { console.log("\n Data : \n\n" +fileData); var options = { host: 'kkk', port: 1, path: '/root', method: 'POST', headers: { "Content-Type" :