Skip to main content
Convert a WSDL (Web Services Description Language) file into a Bruno collection folder of SOAP requests you can open in the app or run with the CLI. The converter creates one request per operation, with a SOAP envelope built from the XML schema and the Content-Type and SOAPAction headers already set.
You do not need a script to import a WSDL file. The Bruno app imports one through Import Collection (see Import collections), and the CLI does it in one command: bru import wsdl --source <service.wsdl> --output <output-folder> (see Import Data). Use the script below when you want to process the collection in your own code.
WSDL import is available in Bruno v2.14.0 and later.

Convert the WSDL

Install both packages:
The converter returns a JavaScript object. Bruno needs a collection folder, so the script below converts the input and writes that folder in one go. It writes OpenCollection YAML files by default. Change format to 'bru' for .bru files instead.
The script needs Node.js 18 or later.

1. Read the arguments

Import the converter, the file writers from @usebruno/filestore, and Node’s file helpers. Take the paths from the command line and print a usage line if any are missing. format is 'yml' for OpenCollection YAML or 'bru' for classic .bru files.

2. Add the helpers

safeName strips characters that are not allowed in file names. write saves a file and creates any missing parent folders.

3. Convert

wsdlToBruno resolves to the Bruno collection. See the API Reference for the full signature.

4. Write the collection settings and environments

brunoConfig holds the collection settings. For .bru collections it is written to bruno.json. For yml it is embedded in opencollection.yml. The collection root holds collection-level auth, headers, and scripts. Each environment gets its own file in the environments folder.

5. Write the folders and requests

Each folder becomes a directory and each request a file. Folder-level auth, headers, and scripts go in folder.yml or folder.bru. A stack is used instead of recursion so deeply nested collections are safe.

6. Report

Print where the collection was written.

7. Run the script

Run the script with Node.js, passing the paths as arguments.
Where:
  • <service.wsdl>: The WSDL file
  • <output-folder>: The folder to create the Bruno collection in. It is created if it does not exist
The output folder looks like this (with format set to 'bru', the files are bruno.json, collection.bru, folder.bru, and .bru requests instead):
One folder per service, one file per operation.

Full script

The complete script, ready to copy. convert.mjs is an ES module with top-level await. convert.js is the same script as CommonJS, with the steps inside an async main function.

Open the collection in the app or run it with the CLI

Open the folder in the app, or run it with the CLI:
  1. Click the + button in the top-left corner and select Import Collection.
  2. Choose Bruno Collection, then browse to the output folder.
  3. Click Import.
See Import Collections for more detail.

Generated request structure

Each SOAP operation in the collection has the following structure:

Request headers

Request body