Home » Javascript » node-soap client return malformed object

node-soap client return malformed object

Posted by: admin November 1, 2017 Leave a comment

Questions:

I’m using node-soap client to get some data using soap protocol, when I call any method I get malformed result which is not the same when I use php nusoap package?

here is my nodejs code:

var soap = require('soap');

soap.createClient(url, function(err, client) {

    var args = {
        keyStr: key,
        startDate: '2017/10/01',
        endDate: '2017/10/26'
    }

    client.getResultRange(args, function(err, result) {

        console.log(result);

    });

});

Result:

{
    "return":[{
        "attributes":{
            "xsi:type":"ax21:StructDelegate"
        },
        "entries":[{
            "attributes":{
                "xsi:type":"ax21:EntryDelegate"
            },
            "key":{
                "attributes":{
                    "xsi:type":"xs:string"
                },
                "$value":"STATUS"
            },
            "value":{
                "attributes":{
                    "xsi:type":"xs:string"
                },
                "$value":"P"
            }
        },
        {
            "attributes":{
                "xsi:type":"ax21:EntryDelegate"
            },
            "key":{
                "attributes":{
                    "xsi:type":"xs:string"
                },
                "$value":"DATETIME"
            },
            "value":{
                "attributes":{
                    "xsi:type":"xs:string"
                },
                "$value":"2017/10/23 14:21:07"
            }
        }]
    }]
}

php Result using nusoap:

[
    ['STATUS' => 'P'],
    ['DATETIME' => '2017/10/23 14:21:07']
]

As you can notice, nusoap return only array without details

Answers: