strong-soap provides a comprehensive Node.js module for interacting with SOAP web services, offering both client capabilities for invoking services and a mock-up server for testing. Currently at version 5.0.9, it maintains an active development pace with frequent patch and minor updates, typically on a monthly or bi-monthly schedule, and major versions released approximately annually to biennially, often aligning with Node.js version support. The library is built upon the `node-soap` module and distinguishes itself by supporting both RPC and Document styles, as well as SOAP 1.1 and 1.2 Faults. It includes utility APIs for converting XML to JSON and vice versa, describing WSDL documents, and handling both synchronous and asynchronous service method calls. A key feature is its built-in WS-Security support, specifically for UsernameToken and PasswordText encoding, enhancing its utility for enterprise integrations.
npm install strong-soapVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a SOAP client from a WSDL URL and invoke a method (GetQuote) on a public stock quote web service. It highlights asynchronous client creation and method invocation using Promises for modern JavaScript patterns, showing how to pass arguments and handle responses or errors.
Upgrade your Node.js environment to version 20 or later, or pin `strong-soap` dependency to a 4.x version (`npm install strong-soap@^4`).
Ensure `ursa` (or `node-forge` if `strong-soap` supports it in newer versions) is explicitly listed in your `package.json` dependencies and installs successfully. Refer to `ursa`'s documentation for platform-specific build prerequisites. If `ursa` fails, consider alternative security configurations or manually manage the dependency.
Implement a timeout mechanism around `soap.createClient` to catch hanging operations. Debug the problematic WSDL for structural issues or very large inline schemas. Consider pre-processing WSDLs if possible or filing a detailed bug report with the `strong-soap` project.
Customize the `wsdl_options` in `soap.createClient` to override `attributesKey`, `valueKey`, and `xmlKey` to match your desired parsing behavior or the service's specific XML structure.
Ensure that your server-side implementation of `strong-soap` is compatible with attributes in the `Body` tag. Check for updates to `strong-soap` that address this. If unavailable, adjust the client to avoid sending attributes in the `Body` or modify the server's XML parsing logic if possible.
Verify the WSDL URL and SOAP endpoint are correct and accessible from the environment where your Node.js application is running. Check network connectivity, firewall rules, and proxy settings if applicable.
Inspect the raw `envelope` or `client.lastResponse` (if available in client events) to understand the actual response from the server. This can reveal if the service returned an error page, invalid XML, or an unexpected SOAP fault. Validate the service's WSDL and expected response structure.
Review the WSDL and the structure of your request arguments. Ensure that any custom headers or complex types requiring specific namespaces for attributes are correctly defined. This might require custom XML building or specific `wsdlOptions` to force namespace declarations.