{"id":15043909,"url":"https://github.com/lehh/nestjs-soap","last_synced_at":"2025-04-07T18:12:24.195Z","repository":{"id":37033644,"uuid":"354053271","full_name":"lehh/nestjs-soap","owner":"lehh","description":"Nestjs module wrapper for soap npm package","archived":false,"fork":false,"pushed_at":"2025-03-16T14:42:29.000Z","size":716,"stargazers_count":22,"open_issues_count":10,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T17:16:23.828Z","etag":null,"topics":["nestjs","soap"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lehh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-02T15:06:47.000Z","updated_at":"2025-03-16T14:47:16.000Z","dependencies_parsed_at":"2022-06-29T10:34:14.349Z","dependency_job_id":"bc737899-01ac-41f5-80c4-ff8b16ae1f85","html_url":"https://github.com/lehh/nestjs-soap","commit_stats":{"total_commits":76,"total_committers":9,"mean_commits":8.444444444444445,"dds":0.2894736842105263,"last_synced_commit":"7164321be243350e97f1eb71b168a9d9f45ee18b"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lehh%2Fnestjs-soap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lehh%2Fnestjs-soap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lehh%2Fnestjs-soap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lehh%2Fnestjs-soap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lehh","download_url":"https://codeload.github.com/lehh/nestjs-soap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704571,"owners_count":20982298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nestjs","soap"],"created_at":"2024-09-24T20:49:48.617Z","updated_at":"2025-04-07T18:12:24.150Z","avatar_url":"https://github.com/lehh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.npmjs.com/nestjs-soap\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/nestjs-soap.svg?v2\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/nestjs-soap\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/nestjs-soap.svg\" alt=\"Package License\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/nestjs-soap\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/nestjs-soap.svg\" alt=\"NPM Downloads\" /\u003e\u003c/a\u003e\n\n# Nestjs Soap\n\n### Nestjs module wrapper for [soap](https://www.npmjs.com/package/soap) npm package\n\n## Compatibility\n\nFor nestjs \u003c v8.4.0 use v2 package.\n\nFor nestjs \u003e= v8.4.0 use v3 package.\n\n## Install\n\n```bash\nnpm install nestjs-soap\n```\nOr, if you use yarn\n```bash\nyarn add nestjs-soap\n```\n\n## Documentation\n\n### [Upgrading to v2](./docs/upgrading-to-v2.md)\n### [v1 docs](./docs/v1.md)\n\n## Getting Started\n\nAfter installing the package, just import the SoapModule on the module you want to use the soap client.  \n\n```javascript\nimport { Module } from '@nestjs/common';\nimport { SoapModule } from 'nestjs-soap';\n\n@Module({\n  imports: [\n    SoapModule.register(\n      { clientName: 'MY_SOAP_CLIENT', uri: 'http://yourserver/yourservice.wso?wsdl' },\n    ),\n  ],\n})\nexport class ExampleModule {}\n```\nThe `register` or `forRoot` function receives a [SoapModuleOptions](#SoapModuleOptions) object. You can register as many clients as you need, each with an unique `clientName`.\n\nAnother way to import the SoapModule is using `forRootAsync` or `registerAsync`, like other [factory provider](https://docs.nestjs.com/fundamentals/custom-providers#factory-providers-usefactory). It receives a [SoapModuleAsyncOptions](#SoapModuleOptions) object. Our factory function can be `async` and can inject dependencies through `inject`:\n\n```javascript\nimport { Module } from '@nestjs/common';\nimport { SoapModule, SoapModuleOptions } from 'nestjs-soap';\nimport { ConfigService, ConfigModule } from '@nestjs/config';\n\n@Module({\n  imports: [\n    SoapModule.forRootAsync(\n      { \n        clientName: 'MY_SOAP_CLIENT',\n        imports: [ConfigModule],\n        inject: [ConfigService],\n        useFactory: async (\n          configService: ConfigService,\n        ): Promise\u003cSoapModuleOptions\u003e =\u003e ({\n          uri: configService.get\u003cstring\u003e('soap.uri'),\n          auth: {\n            type: 'basic',\n            username: configService.get\u003cstring\u003e('soap.username'),\n            password: configService.get\u003cstring\u003e('soap.password'),\n          },\n        }),        \n      }\n    ),\n  ],\n})\nexport class ExampleModule {}\n```\n\n\nThen, inject the client where you want to use it.\n```javascript\nimport { Inject, Injectable } from '@nestjs/common';\nimport { Client } from 'nestjs-soap';\n\n@Injectable()\nexport class ExampleService {\n  constructor(@Inject('MY_SOAP_CLIENT') private readonly mySoapClient: Client) {}\n\n  async exampleFunction() {\n    return await this.mySoapClient.YourFunctionAsync();\n  }\n}\n\n```\n\nThe injected Client is from the soap npm package. This example is using the [soap method async](https://www.npmjs.com/package/soap#clientmethodasyncargs-options---call-method-on-the-soap-service) from soap package. From here, please follow the [Client](https://www.npmjs.com/package/soap#client) use instructions on the soap repository.\n\n### Soap Module Factory\n\nYou can also create your own factory implemeting SoapModuleOptionsFactory\n\n```typescript\nimport { Injectable, Inject } from '@nestjs/common';\nimport { ConfigService } from '@nestjs/config';\nimport { SoapModuleOptionsFactory, SoapModuleOptionsFactoryType } from 'nestjs-soap';\n\n@Injectable()\nexport class ExampleSoapConfigService implements SoapModuleOptionsFactory {\n  constructor(\n    @Inject(ConfigService) private readonly configService: ConfigService\n  )\n\n  createSoapModuleOptions(): SoapModuleOptionsFactoryType {\n    return {\n      uri: configService.get\u003cstring\u003e('soap.uri'),\n      auth: {\n        type: 'basic',\n        username: configService.get\u003cstring\u003e('soap.username'),\n        password: configService.get\u003cstring\u003e('soap.password'),\n      },\n    };\n  }\n}\n```\nThen, import it using `useClass` or `useExisting`:\n```typescript\nimport { Module } from '@nestjs/common';\nimport { SoapModule, SoapModuleOptions } from 'nestjs-soap';\nimport { ExampleSoapConfigService } from './example-config'\n\n@Module({\n  imports: [\n    SoapModule.forRootAsync(\n      { \n        clientName: 'MY_SOAP_CLIENT',\n        useClass: ExampleSoapConfigService        \n      }\n    ),\n  ],\n})\nexport class ExampleModule {}\n```\nNote: for the `useExisting` provider you need to import the module containing the `ExampleSoapConfigService` provider.\n### SoapModuleOptions\n`clientName`: The unique client name for class injection.\n\n`uri`: The SOAP service uri.\n\n`auth` (optional): Basic or WSSecurity authentication. Fields `type` (basic or wssecurity), `username` and `password` are required. For the WSSecurity `options` field, refer to [soap-repository](https://www.npmjs.com/package/soap#wssecurity)\n \n`clientOptions` (optional): The soap client options as in [soap repository](https://www.npmjs.com/package/soap#options).\n\n### SoapModuleAsyncOptions\n`clientName`: The unique client name for class injection.\n\n`inject`: Array of dependencies to be injected.\n\n`useClass`: A class implementing `SoapModuleOptionsFactory`.\n\n`useExisting`: An injectable class implementing `SoapModuleOptionsFactory`.\n\n`useFactory`: A factory function returning a [SoapModuleOptions](#SoapModuleOptions) object.\n\n`imports`: Array of modules containing the injected dependencies.\n\n`scope`: Injection scope of the injected provider.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flehh%2Fnestjs-soap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flehh%2Fnestjs-soap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flehh%2Fnestjs-soap/lists"}