usebruno/bruno · error · Error
WSDL content must be a string
Error message
WSDL content must be a string
What it means
Thrown by wsdlToBruno when the wsdlContent argument is not of type string. The parser pipeline (parseXML, WSDLParser) operates on a string, so passing a Buffer, an object, null, or undefined is rejected up front. This is a pure input-type guard at the public API boundary.
Source
Thrown at packages/bruno-converters/src/wsdl/wsdl-to-bruno.js:1113
// Add all operations directly to the service folder
serviceFolder.items = allOperations;
if (serviceFolder.items.length > 0) {
collection.items.push(serviceFolder);
}
}
return collection;
};
/**
* Convert WSDL content to Bruno collection
*/
export const wsdlToBruno = async (wsdlContent) => {
try {
if (typeof wsdlContent !== 'string') {
throw new Error('WSDL content must be a string');
}
// Parse WSDL using enhanced parser
const parser = new WSDLParser();
const wsdlData = await parser.parse(wsdlContent);
const collection = parseWSDLCollection(wsdlData);
const transformedCollection = transformItemsInCollection(collection);
const hydratedCollection = hydrateSeqInCollection(transformedCollection);
const validatedCollection = validateSchema(hydratedCollection);
return validatedCollection;
} catch (err) {
console.error(err);
throw new Error('Import WSDL collection failed: ' + err.message);
}
};
View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Read the file with an encoding: `fs.readFileSync(path, 'utf8')` or `fs.promises.readFile(path, 'utf8')`.
- If you have a Buffer, convert: `wsdlToBruno(buffer.toString('utf8'))`.
- Ensure you pass the raw XML text, not a pre-parsed object.
Example fix
// before
const buf = fs.readFileSync('service.wsdl');
await wsdlToBruno(buf); // Buffer, not string
// after
const text = fs.readFileSync('service.wsdl', 'utf8');
await wsdlToBruno(text); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof wsdlContent !== 'string') {
wsdlContent = Buffer.isBuffer(wsdlContent) ? wsdlContent.toString('utf8') : String(wsdlContent);
} Type guard
const isStringContent = (c) => typeof c === 'string';
Prevention
- Always read WSDL files with an 'utf8' encoding argument.
- Convert Buffers explicitly: buf.toString('utf8').
- Do not pre-parse the XML before calling wsdlToBruno.
When it happens
Trigger: Calling wsdlToBruno(buffer) where buffer is a Node Buffer from fs.readFile (without encoding); passing the parsed object from xml2js directly; passing null/undefined; passing a number.
Common situations: Reading a .wsdl file with fs.readFile (no encoding) and passing the Buffer; forgetting to await fs.promises.readFile(path, 'utf8'); double-parsing the XML before calling.
Related errors
- The Collection has an invalid schema: ${err.message}
- No definitions found in WSDL
- Import WSDL collection failed: ${err.message}
- Unknown error
- Invalid URL format: ${url}
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/ff1307e9efaf6d98.
Report an issue: GitHub.