Erik
Erik

Reputation: 11

NodeJS / NestJS application SOAP listener with WS-Security

I need to expose a SOAP listener with WS-Security in a nodeJS /nestJS application.

Currently, I did not find any existing library that supports WS-Security on the server listner side. According to the documentation, it allows use only for the client.

I probably have no choice but to implement my own solution. For WS-Security validation, I need to work with a RAW input request, can anyone advise me on how to access it?

My code now looks like this:

import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { service} from "./serv/serv.service";
import * as soap from 'soap';
import * as http from 'http';

@Injectable()
export class AppService implements OnApplicationBootstrap {
    constructor(private readonly serv: Service) {}

    onApplicationBootstrap() {
        const server = http.createServer((req, res) => {});
 
        server.listen(3000, () => {
            console.log('listening on port 3000');
        });

        const soapServer = soap.listen(server, '/soap', this.serv.process(), this.serv.getWsdl(), (err, res) => {
            if (err) {
                console.error('error binding serv WSDL:', err);
            } else {
                console.log('service is running');
            }
        });

        soapServer.authenticate = function (security) {

            return true;
        };
    }
}

.authenticate function contains an already parsed request header.

Can anyone advise me? Or direct to a more appropriate approach?

Thank you

I tried different approaches, searched the available libraries but didn't find a working concept.

Upvotes: 1

Views: 30

Answers (0)

Related Questions