{"library":"soap","title":"Node.js SOAP Client and Server","type":"library","description":"Node-SOAP is a robust and minimal JavaScript library designed for interacting with SOAP web services, offering both client-side and server-side functionalities. Currently at stable version 1.9.1, the project maintains a regular release cadence focused on dependency updates, security patches, and minor enhancements, typically releasing new versions every few weeks or months. Its key differentiators include comprehensive support for various SOAP security mechanisms such as BasicAuth, WS-Security, and NTLM, and a flexible API that supports both callback-based and modern promise-based interactions with WSDL-defined services. The library ships with TypeScript types, making it well-suited for contemporary Node.js applications. It targets Node.js versions 20.19.0 and higher.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install soap"],"cli":null},"imports":["import { createClientAsync } from 'soap';","import { listen } from 'soap';","import { WSSecurity } from 'soap';","import type { Client } from 'soap';"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/vpulim/node-soap","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/soap","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import { createClientAsync, BasicAuthSecurity, Client } from 'soap';\n\nasync function consumeWebService() {\n  const wsdlUrl = 'http://www.dneonline.com/calculator.asmx?WSDL'; // Public test WSDL\n  let client: Client | undefined;\n  try {\n    client = await createClientAsync(wsdlUrl);\n    console.log('SOAP client initialized successfully.');\n\n    // Optional: Add security headers if required by the service\n    // client.setSecurity(new BasicAuthSecurity('username', 'password'));\n\n    // You can inspect available methods and types:\n    // console.log(client.describe());\n\n    // Call a method, e.g., 'Add' from the Calculator service\n    const args = { intA: 10, intB: 5 };\n    console.log(`Calling 'Add' method with arguments: ${JSON.stringify(args)}`);\n    const result = await client.AddAsync(args);\n\n    console.log('Result from SOAP service (Add):', result[0].AddResult);\n  } catch (error) {\n    console.error('Error consuming SOAP web service:', error instanceof Error ? error.message : error);\n    // For detailed debugging, inspect the last request/response\n    if (client) {\n      console.error('Last Request (XML):', client.lastRequest);\n      console.error('Last Response (XML):', client.lastResponse);\n    }\n  }\n}\n\nconsumeWebService();","lang":"typescript","description":"Demonstrates asynchronous SOAP client creation, calling a service method (Add), and basic error handling with security options.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}