3

I've been trying to connect to a web service using node-soap but keep on getting the error "Cannot read property 'Body' of undefined". I believe the problem is that the SOAP envelope generated by node-soap is incorrect and needs to use ns1 instead of tns. Please see the envelope generated by PHP's SoapClient which successfully connects to the web service and node-soap's generated envelope below:

PHP

    <SOAP-ENV:Body>
        <ns1:IsHealthy/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Node-SOAP

    <soap:Body>
        <tns:IsHealthy xmlns:tns="http://tempuri.org/" xmlns="http://tempuri.org/">
        </tns:IsHealthy>
    </soap:Body>
</soap:Envelope>

Is there a setting to tell node soap to use ns1 or a way to modify the envelope before sending?

Lehan Coetzee
  • 424
  • 2
  • 7
  • 28

1 Answers1

0

During create client , you could pass parameter :

var options = {
   envelopeKey:'soapenv',
   xmlKey: 'sdm'
  };
soap.createClient(url, options, function(err, client) {

}

Documentation

kinkajou
  • 3,664
  • 25
  • 75
  • 128