Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
nestjs-soap
Advanced tools
Nestjs module wrapper for soap
This package internally uses soap npm package
npm install nestjs-soap
Or, if you use yarn
yarn add nestjs-soap
After installing the package, just import the SoapModule on the module you want to use the soap client.
import { Module } from '@nestjs/common';
import { SoapModule } from 'nestjs-soap';
@Module({
imports: [
SoapModule.registerAsync([
{ name: 'MY_SOAP_CLIENT', uri: 'http://yourserver/yourservice.wso?wsdl' },
]),
],
})
export class ExampleModule {}
The registerAsync
or forRoot
function receives an array of SoapModuleOptions. This means you can create as many clients you need. You just need to create unique names for each one.
Another way to import the SoapModule is using forRootAsync
, like other factory provider. Our factory function can be async
and can inject dependencies through inject
:
import { Module } from '@nestjs/common';
import { SoapModule, SoapModuleOptions } from 'nestjs-soap';
import { ConfigService } from '@nestjs/config';
@Module({
imports: [
SoapModule.forRootAsync([
{
name: 'MY_SOAP_CLIENT',
inject: [ConfigService],
useFactory: async (
configService: ConfigService,
): Promise<SoapModuleOptions> => ({
uri: configService.get<string>('soap.uri'),
auth: {
username: configService.get<string>('soap.username'),
password: configService.get<string>('soap.password'),
},
}),
}
]),
],
})
export class ExampleModule {}
Then inject the client where you want to use it.
import { Inject, Injectable } from '@nestjs/common';
import { Client } from 'nestjs-soap';
@Injectable()
export class ExampleService {
constructor(@Inject('MY_SOAP_CLIENT') private readonly mySoapClient: Client) {}
async exampleFunction() {
return await this.mySoapClient.YourFunctionAsync();
}
}
The injected Client is from the soap npm package. From here, please follow the use instructions on the soap repository.
name
: The unique client name for class injection.
uri
: The SOAP service uri.
auth
: Basic authentication filling in the username
and password
fields when needed.
clientOptions
: The soap client options as in soap repository .
FAQs
Nestjs module wrapper for soap
The npm package nestjs-soap receives a total of 9,201 weekly downloads. As such, nestjs-soap popularity was classified as popular.
We found that nestjs-soap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.