CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

@neoimpulse/cap-js-xml-protocol

A CAP plugin that lets the REST adapter take XML, parsing the payload to JSON and rewriting the content type before CAP sees the request.

Facts

Latestv1.0.5ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
XML payloadsCAPXML payloadscapabilityAccepting and returning XML on a service, or sending it to one, for a counterpart that cannot speak JSON — usually a B2B partner or a system older than the extension in front of it.
Flavors
Node.jsfrom its runtime

Who is behind it

neoimpulse GmbHneoimpulse GmbHOrganisationMaintains this
In the atlas: maintains 7
@neoimpulseGmbH
maintainer

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
Independently maintained
Runtime
Node.js

As a CDS plugin

Distributed through
npm

Connections1

@neoimpulse/cap-js-xml-protocol connections@neoimpulse/cap-js-xml-protocolPROVIDES→ provides1provides authoredXML payloads

Install

npm add @neoimpulse/cap-js-xml-protocol

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from neoimpulseGmbH/cap-js-xml-protocol under MIT, read
neoimpulseGmbH/cap-js-xml-protocol/README.mdOn GitHub

CDS XMLAdapter Plugin

This plugin for the SAP Cloud Application Programming Model (CAP) extends the default REST adapter to support XML payloads. It parses incoming XML data, converts it to JSON, and ensures compatibility with CAP's processing logic.

Features

  • Parses incoming XML payloads into JSON.
  • Converts Content-Type from application/xml to application/json for CAP compatibility.
  • Removes XML namespaces and attributes to create a clean JSON structure.
  • Converts boolean values correctly ("true" → true, "false" → false).
  • Returns appropriate error messages for invalid XML or unsupported content types.

Installation

To install the plugin, add it to your CAP project.

npm install cds-xmladapter-plugin

Usage

  1. Add the XMLAdapter to Your CAP Project

    Extend your CAP server to use the XMLAdapter.

    const cds = require("@sap/cds");
    const XMLAdapter = require("cds-xmladapter-plugin");
    
    cds.on("bootstrap", (app) => {
        app.use(new XMLAdapter().router);
    });
    
    module.exports = cds.server;
  2. Send XML Requests

    Use tools like Postman or custom clients to send requests with XML payloads. Ensure the Content-Type header is set to application/xml.

    Example XML payload:

    <ExchangeRate>
        <ID>123</ID>
        <Rate>10.5</Rate>
        <FromCurrency>EUR</FromCurrency>
        <ToCurrency>USD</ToCurrency>
        <IsValid>true</IsValid>
    </ExchangeRate>
  3. Handle XML Data in CAP

    The plugin automatically converts the XML to JSON, which can be processed by your CAP service logic.

How It Works

The plugin integrates with CAP's middleware pipeline and processes incoming requests as follows:

  1. Checks if the Content-Type is application/xml.
  2. Parses the XML payload into JSON using xml2js.
  3. Removes XML namespaces and attributes.
  4. Converts boolean values ("true" → true, "false" → false).
  5. Updates the Content-Type to application/json for compatibility with CAP services.
  6. Passes the parsed data to the next middleware in the chain.

If the Content-Type is not application/xml, it returns a 415 Unsupported Media Type error. For invalid XML payloads, it returns a 400 Bad Request error.

const cds = require("@sap/cds");
const { parseStringPromise } = require("xml2js");
const HttpAdapter = require("@sap/cds/lib/srv/protocols/http");

class XMLAdapter extends HttpAdapter {
    get router() {
        const router = super.router;

        router.use((req, res, next) => {
            if (req.method in { POST: 1, PUT: 1, PATCH: 1 } && req.headers["content-type"]) {
                if (!req.headers["content-type"].includes("application/xml")) {
                    res.status(415).json({ error: "Invalid content type. Expected 'application/xml'." });
                    return;
                }
            }
            next();
        });

        router.use((req, res, next) => {
            if (req.headers["content-type"] && req.headers["content-type"].includes("application/xml")) {
                let xmlBody = "";
                req.on("data", (chunk) => {
                    xmlBody += chunk.toString();
                });

                req.on("end", async () => {
                    try {
                        const jsonBody = await parseStringPromise(xmlBody, {
                            explicitArray: false,
                            ignoreAttrs: true,
                            tagNameProcessors: [(name) => name.replace(/^.*:/, "")],
                            valueProcessors: [
                                (value) => {
                                    if (value === "true") return true;
                                    if (value === "false") return false;
                                    return value;
                                },
                            ]
                        });

                        req.body = jsonBody;
                        req.headers["content-type"] = "application/json";
                        next();
                    } catch (err) {
                        res.status(400).json({ error: "Invalid XML format." });
                    }
                });
            } else {
                next();
            }
        });

        return router;
    }
}

module.exports = XMLAdapter;

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Thanks to the SAP CAP community for their support and contributions.

MIT, read

History

Latest

v1.0.5

Notes
Bug Fixes
  1. v1.0.4

    Notes
    Bug Fixes
  2. v1.0.3

    Notes
    Bug Fixes
  3. v1.0.2

    Notes
    Bug Fixes
  4. v1.0.1

    Notes
    Bug Fixes
  5. v1.0.0

    Notes
    Bug Fixes
    Features
    • New xml protocol plugin (6020df5)
0downloads per week, npm
Weekly downloads for @neoimpulse/cap-js-xml-protocol26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 0.27 Apr – 3 May: 84 May – 10 May: 2011 May – 17 May: 3718 May – 24 May: 2225 May – 31 May: 101 Jun – 7 Jun: 208 Jun – 14 Jun: 715 Jun – 21 Jun: 1522 Jun – 28 Jun: 529 Jun – 5 Jul: 176 Jul – 12 Jul: 1113 Jul – 19 Jul: 320 Jul – 26 Jul: 1327 Jul – 2 Aug: 13 Aug – 9 Aug: 1510 Aug – 16 Aug: 717 Aug – 23 Aug: 224 Aug – 30 Aug: 1031 Aug – 6 Sept: 87 Sept – 13 Sept: 614 Sept – 20 Sept: 421 Sept – 27 Sept: 128 Sept – 4 Oct: 25 Oct – 11 Oct: 112 Oct – 18 Oct: 219 Oct – 25 Oct: 0

Details

Sources5
npm registrydiscovered here, cds-pluginchecked
npm registrydiscovered here, @cap-jschecked
npm registry, @neoimpulse/cap-js-xml-protocolversion, releases, installschecked
github.com/git+https://github.com/neoimpulseGmbH/cap-js-xml-protocol.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
runtimesnode
latestv1.0.5
first release
releases and cadence6, ~0d median
discovered vianpm registry · cds-plugin, npm registry · @cap-js
first seen in the atlas
ecosystem and domaincap, protocols-and-apis
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:neoimpulse-cap-js-xml-protocol
JSON
/artifacts/neoimpulse-cap-js-xml-protocol.json
MCP
Connecting an agent