A universal SOAP client using the Fetch API - works in browsers, edge runtimes (Cloudflare Workers, Vercel Edge, Deno), and Node.js.
Note: This project is a fork of node-soap v1.6.0, refactored to use the Fetch API instead of Node.js-specific dependencies. It provides a truly universal SOAP client that works anywhere JavaScript runs.
- Universal: Works in browsers, edge runtimes (Cloudflare Workers, Vercel Edge, Deno), and Node.js
- Modern: Uses the Fetch API and ES modules
- Minimal dependencies: No Node.js-specific dependencies
- API compatible: Maintains compatibility with node-soap client API
- Uses Fetch API instead of Axios/http
- Client-only - server functionality has been removed for universal runtime support
- ES modules - published as ESM (
"type": "module") - Removed Node.js-specific security classes (ClientSSLSecurity, NTLMSecurity, WSSecurityCert)
npm install fetch-soapimport * as soap from 'fetch-soap';
// Create a client
const client = await soap.createClientAsync('http://example.com/wsdl?wsdl');
// Call a method
const [result] = await client.MyFunctionAsync({ name: 'value' });
console.log(result);The API is designed to be compatible with node-soap. See the node-soap documentation for detailed API reference.
// Async/await (recommended)
const client = await soap.createClientAsync(url, options);
// Callback style
soap.createClient(url, options, (err, client) => {
// ...
});// Async/await (recommended)
const [result, rawResponse, soapHeader, rawRequest] = await client.MyMethodAsync(args);
// Callback style
client.MyMethod(args, (err, result, rawResponse, soapHeader, rawRequest) => {
// ...
});The following security implementations are available:
// Basic Auth
client.setSecurity(new soap.BasicAuthSecurity('username', 'password'));
// Bearer Token
client.setSecurity(new soap.BearerSecurity('token'));
// WS-Security (UsernameToken)
client.setSecurity(new soap.WSSecurity('username', 'password', options));Note: Node.js-specific security classes (ClientSSLSecurity, NTLMSecurity, WSSecurityCert) are not available in this universal build.
fetch-soap aims to be a drop-in replacement for node-soap's client functionality. The main differences are:
- ES modules only - use
importinstead ofrequire - Client-only -
soap.listen()and server functionality are not available - Fetch API - uses Fetch instead of Axios/http (custom fetch can be provided via options)
- Limited security - only BasicAuthSecurity, BearerSecurity, and WSSecurity are available
- No file system access - WSDL must be loaded via URL or passed as a string
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE
This project is a fork of node-soap, originally created by Vinay Pulim and maintained by the node-soap community.