Search code examples
node.jsweb-servicessoapwsdl

About NodeJS strong-soap result


I'm currently working on a SOAP project in NodeJS, and i am fairly new to SOAP. My question is about returned result from client.

const express = require('express')();
const soap  = require('strong-soap').soap;
//const Promise = require('promise');
const bodyParser = require('body-parser');

var service = { ... };

var request = { ... };

 let url = 'http://localhost:XXXX/wsdl?wsdl';

 const clientPromise = () => 
    soap.createClient(url, {}, (err, client) => {
        client.addSoapHeader('...');
        
        client.MyMethod(request).then(res => console.log(res));
    });

After running this script, client.MyMethod function returns an object, which seems like this:

{
result: undefined
envelope: "s'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' +
    '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">\n' +
    '  <soap:Header/>\n' +
    '  <soap:Body>\n' +
    '    <_U>0</_U>\n' +
    '    <_V>1</_V>\n' +
    '    <_W>\n' +
    '      <UnlockConnector>\n' +
    '        <status>Accepted</status>\n' +
    '      </UnlockConnector>\n' +
    '    <_X/>\n' +
    '  </soap:Body>\n' +
    '</soap:Envelope>',"
SOAPHeaders: undefined
}

My question is why remote server returns response like this? What does result undefined means? And why SOAP headers is undefined? I see only envelope. Does this response means that process executed successfully? Please illuminate me! Thanks


Solution

  • Looks like it has something to do with your WSDL

    http://localhost:XXXX/wsdl?wsdl