npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wsdl-tsclient

v1.7.1

Published

Generate typescript soap client with typescript definitons from WSDL file.

Downloads

71,429

Readme

WSDL TSClient

license Known Vulnerabilities npm-version

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 i soap).

Install

npm i wsdl-tsclient

or install it with -g to have CLI globally available.

npm i -g wsdl-tsclient

or you can use npx to run it without installing

npx wsdl-tsclient ./path/to/wsdl.wsdl -o ./generated/

Usage

You can check example repository wsdl-tsclient-example

Generate client using CLI

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 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]
      --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/

Generate client programmatically

import { generateClient } from "wsdl-tsclient";

parseAndGenerate("./path/to/MyWsdl.wsdl", "./generated/");

Using generated client in your project

Note: Make sure you have soap package in your runtime dependencies (npm i soap)

import { createClientAsync } from "./generated/MyWsdl";

const client = await createClientAsync("./path/to/wsdl.wsdl");
client.CallSoapMethodAsync();

Setting basic auth

import soap from "soap";
import { createClientAsync } from "./generated/MyWsdl";

const client = await createClientAsync("./path/to/wsdl.wsdl");

const basicAuth = new soap.BasicAuthSecurity(auth.username, auth.password);
client.setSecurity(basicAuth);

client.CallSoapMethodAsync();

for more information about the use of the client, read more about soap

How it works

overview

Develpoment

  • Clone the repository
  • Install dependencies npm i
  • Run tests npm test

License

The source code is licensed under the MIT license

Contributors

Contributors