Note
This project is a fork of sanderhurlen/wsdl-tsclient which in turn is a fork of dderevjanik/wsdl-tsclient.
The original project appears unmaintained. @sanderhurlen's fork has a fix for #96 which we needed. But the fork isn't updated otherwise.
We forked it to update dependencies and have added @dependabot to keep them up to date going forward.
Example how to generate and use wsdl-tsclient: wsdl-tsclient-example
Generate a soap client with typescript definitions from a WSDL file.
This library uses ts-morph to generate typescript code and soap for runtime. Inspired by Java wsimport and openapi-generator.
NOTE: Add soap to your npm
runtime dependencies (npm install soap).
npm install @reloaddk/wsdl-tsclient --save-devor install it with -g to have CLI globally available.
npm install -g @reloaddk/wsdl-tsclientor you can use npx to run it without installing
npx @reloaddk/wsdl-tsclient ./path/to/wsdl.wsdl -o ./generated/You can check example repository wsdl-tsclient-example
Easiest way to generate client from is to use CLI. You need to provide
only path to .wsdl file and path to output directory (-o
param). If you want to generate only typescript types (no runtime
code) for node-soap, you can pass --emitDefinitionsOnly param.
wsdl-tsclient ./soap.wsdl -o ./generated
wsdl-tsclient ./resources/**/*.wsdl -o ./generated - using glob
you can also use npx
npx @reloaddk/wsdl-tsclient ./soap.wsdl -o ./generated
wsdl-tsclient [options] [path]
Options:
      --help                        Show help                          [boolean]
  -v, --version                     Show version number                [boolean]
  -o                                Output directory for generated TypeScript
                                    client                   [string] [required]
      --emitDefinitionsOnly         Generate definitions only (interfaces and
                                    types)                             [boolean]
      --modelNamePreffix            Prefix for generated interface names[string]
      --modelNameSuffix             Suffix for generated interface names[string]
      --modelPropertyNaming         Property naming convention ('camelCase' or
                                    'PascalCase')                       [string]
      --caseInsensitiveNames        Parse WSDL definitions case-insensitively
                                                                       [boolean]
      --useWsdlTypeNames            Use wsdl schema type names instead of
                                    parameter names for generated interface
                                    names                              [boolean]
      --maxRecursiveDefinitionName  Maximum count of definitions with the same
                                    name but increased suffix. Will throw an
                                    error if exceeded.                  [number]
      --esm                         Generate imports with .js suffix   [boolean]
      --quiet                       Suppress all logs                  [boolean]
      --verbose                     Print verbose logs                 [boolean]
      --no-color                    Logs without colors                [boolean]
Examples:
    wsdl-tsclient file.wsdl -o ./generated/
    wsdl-tsclient ./res/**/*.wsdl -o ./generated/import { generateClient } from "@reloaddk/wsdl-tsclient";
parseAndGenerate("./path/to/MyWsdl.wsdl", "./generated/");Note: Make sure you have soap
package in your runtime dependencies (npm install soap)
import { createClientAsync } from "./generated/MyWsdl";
const client = await createClientAsync("./path/to/wsdl.wsdl");
client.CallSoapMethodAsync();Setting basic auth
import { BasicAuthSecurity } from "soap";
import { createClientAsync } from "./generated/MyWsdl";
const client = await createClientAsync("./path/to/wsdl.wsdl");
const basicAuth = new BasicAuthSecurity(auth.username, auth.password);
client.setSecurity(basicAuth);
client.CallSoapMethodAsync();for more information about the use of the client, read more about soap
- Clone the repository
 - Install dependencies 
npm install - Run tests 
npm test 
The source code is licensed under the MIT license
