title: How to send xml post params with the help of node.js
body: <p>Trying to post XML data to following url via node js:-</p>
  
  <pre><code>var request = require("request");
  var utf8 = require('utf8');
  
  
  
  var abc = '&lt;ENVELOPE&gt;&lt;HEADER&gt;&lt;TALLYREQUEST&gt;Export Data&lt;/TALLYREQUEST&gt;&lt;/HEADER&gt;&lt;BODY&gt;&lt;EXPORTDATA&gt;&lt;REQUESTDESC&gt;&lt;REPORTNAME&gt;Stock Summary&lt;/REPORTNAME&gt;&lt;STATICVARIABLES&gt;&lt;EXPLODEFLAG&gt;Yes&lt;/EXPLODEFLAG&gt;&lt;SVEXPORTFORMAT&gt;$$SysName:XML&lt;/SVEXPORTFORMAT&gt;&lt;ACCOUNTTYPE&gt;All Inventory Masters&lt;/ACCOUNTTYPE&gt;&lt;/STATICVARIABLES&gt;&lt;/REQUESTDESC&gt;&lt;/EXPORTDATA&gt;&lt;/BODY&gt;&lt;/ENVELOPE&gt;';
  
  request.post({
      url:"http://192.168.1.148",
      port: 9000,
      method:"POST",
      headers:{
          'Content-Type': 'application/xml',
      },
       body: abc
  },
  function(error, response, body){
      console.log(response.statusCode);
      console.log(body);
      console.log(error);
  });
  </code></pre>
  
  <p>But interpreter is showing following error:-</p>
  
  <blockquote>
  <pre><code>console.log(response.statusCode);
                      ^
  TypeError: Cannot read property 'statusCode' of undefined
  at Request._callback (C:\Users\bliscar\prog10.js:18:25)
  at self.callback (C:\Users\bliscar\node_modules\request\request.js:198:22)
  at Request.emit (events.js:107:17)
  at Request.onRequestError (C:\Users\bliscar\node_modules\request\request.js:
  </code></pre>
    
    <p>861:8)
        at ClientRequest.emit (events.js:107:17)
        at Socket.socketErrorListener (_http_client.js:271:9)
        at Socket.emit (events.js:107:17)
        at net.js:459:14
        at process._tickCallback (node.js:355:11)</p>
  </blockquote>
  
  <p>Not able to work out what's the issue. Please help to resolve.</p>