Overriding WSDL endpoint in node-soap

Recently at work I needed to use node-soap to interface with some old SOAP-based systems. It’s certainly a pain compared to REST, but node-soap is a useful npm module should you ever find yourself needing to call SOAP methods from node.js.

Something that tripped me up as we were moving packages up to higher environments was overriding the default endpoint in the WSDL. Using node-soap, when you create the soap client, you can optionally pass in an endpoint to override the SOAP service’s host specified in the .wsdl file. If you do this, you must pass it in in the format { endpoint: 'your-endpoint-here'}. This was confusing as this format is not documented in the README or the unit tests. If you have multiple silos or environments, you’ll want to use process.env to store the endpoint for each environment and reference that environment variable as the value for the endpoint property.

Hopefully this will help anyone else who might get stuck on this.

 

coreyc

 

Leave a Reply

Your email address will not be published. Required fields are marked *