3

I try to deploy my node application inside the "IIS 8". I have installed iisnode.

The basic application is running perfectly.

But I go with SOAP, I am getting below error.

Application has thrown an uncaught exception and is terminated:
TypeError: Cannot read property 'setSecurity' of undefined
    at C:\inetpub\iisnode\www\salesorder\so.js:32:11
    at C:\inetpub\iisnode\www\salesorder\node_modules\strong-soap\src\soap.js:48:5
    at C:\inetpub\iisnode\www\salesorder\node_modules\strong-soap\src\soap.js:30:16
    at ReadFileContext.callback (C:\inetpub\iisnode\www\salesorder\node_modules\strong-soap\src\parser\wsdl.js:370:11)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:336:13)

Code:

var express = require('express');
var app = express();

app.get('/node/salesorder/myapp/salesorderquery', function(req, res){
    var json = req.query;
  var soap = require('strong-soap').soap;
  var url = '../wsdl/SalesOrderQuery.wsdl';
  var requestArgs = {
    SalesOrderByElementsQuery_sync : {
      ProcessingConditions : {
        QueryHitsMaximumNumberValue : 2 , //json.QueryHitsMaximumNumberValue,
        QueryHitsUnlimitedIndicator : false,
        LastReturnedObjectID : "0000000000011ED18B8B8EA6C678AAE6"
      }
    }
  };
  var options = {
    attributesKey: '$attributes'
  };

  soap.createClient(url, options, function(err, client) {
    client.setSecurity(new soap.BasicAuthSecurity("**APP","******"));
     client.FindByElements(requestArgs, function(err, result, envelope) {
      res.send(JSON.stringify(result));
    });
  });
})

app.listen(process.env.PORT);

Please help me solve this problem.

Regards Sankaran A

sankaran
  • 143
  • 1
  • 3
  • 11
  • 1
    The error indicates that `client` variable is undefined. You can use `console.log()` function to log the variable `err` to trace the root cause. – Aaron Chen Feb 08 '17 at 06:51
  • 1
    TypeError: Cannot read property 'setSecurity' of undefined - getting this error while running from node cmd. – sankaran Feb 08 '17 at 07:23
  • 2
    The reason the exception is thrown is because if you attempt to access a property of an object that (string, number, object, etc) is undefined, then that property does not actually exist for you to access. Could you add `console.log(err)` before the line `client.setSecurity(...)` and share the output message with us? – Aaron Chen Feb 08 '17 at 07:36
  • 1
    Thanks @AaronChen-MSFT It is solved. I reinstall strong-soap. It is solved. – sankaran Feb 08 '17 at 11:39

0 Answers0