{"id":24327687,"url":"https://github.com/rishikeshdarandale/apollo-datasource-soap","last_synced_at":"2025-10-28T20:36:52.286Z","repository":{"id":34049717,"uuid":"166755101","full_name":"RishikeshDarandale/apollo-datasource-soap","owner":"RishikeshDarandale","description":"A simple implementaion of apollo datasource for soap requests","archived":false,"fork":false,"pushed_at":"2024-11-01T05:15:13.000Z","size":1919,"stargazers_count":12,"open_issues_count":11,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T15:51:48.442Z","etag":null,"topics":["apollo","apollo-datasource","apollo-datasource-soap","graphql"],"latest_commit_sha":null,"homepage":"https://rishikeshdarandale.github.io/apollo-datasource-soap/","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/RishikeshDarandale.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2019-01-21T05:45:42.000Z","updated_at":"2023-05-26T05:25:32.000Z","dependencies_parsed_at":"2024-06-19T22:48:50.181Z","dependency_job_id":"a56bac32-68f9-4e6e-9ff3-ef2470d789bd","html_url":"https://github.com/RishikeshDarandale/apollo-datasource-soap","commit_stats":{"total_commits":281,"total_committers":5,"mean_commits":56.2,"dds":0.5338078291814947,"last_synced_commit":"d2619171041143d2a399ba9c7fcd3cae1d463489"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RishikeshDarandale%2Fapollo-datasource-soap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RishikeshDarandale%2Fapollo-datasource-soap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RishikeshDarandale%2Fapollo-datasource-soap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RishikeshDarandale%2Fapollo-datasource-soap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RishikeshDarandale","download_url":"https://codeload.github.com/RishikeshDarandale/apollo-datasource-soap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234435248,"owners_count":18832092,"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":["apollo","apollo-datasource","apollo-datasource-soap","graphql"],"created_at":"2025-01-17T22:14:55.498Z","updated_at":"2025-09-27T12:31:17.713Z","avatar_url":"https://github.com/RishikeshDarandale.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apollo-datasource-soap\n\n![Github Action](https://github.com/RishikeshDarandale/apollo-datasource-soap/actions/workflows/master.yml/badge.svg)\n![CodeQL Analysis](https://github.com/RishikeshDarandale/apollo-datasource-soap/actions/workflows/codeql-analysis.yml/badge.svg)\n[![Known Vulnerabilities](https://snyk.io/test/github/RishikeshDarandale/apollo-datasource-soap/badge.svg)](https://snyk.io/test/github/RishikeshDarandale/apollo-datasource-soap)\n[![npm](https://img.shields.io/npm/v/apollo-datasource-soap.svg)](https://www.npmjs.com/package/apollo-datasource-soap)\n[![npm](https://img.shields.io/npm/dt/apollo-datasource-soap.svg)](https://www.npmjs.com/package/apollo-datasource-soap)\n[![NpmLicense](https://img.shields.io/npm/l/apollo-datasource-soap.svg)](https://github.com/RishikeshDarandale/apollo-datasource-soap/blob/master/LICENSE)\n\nA simple implementation of apollo datasource for soap requests\n\nConnect the SOAP based services to your Apollo server using [Data Sources][1]\n\n`apollo-datasource-soap` versions:\n\n- 1.x =\u003e apollo server 2.x\n- 2.x =\u003e apollo server 3.x\n- 3.x =\u003e apollo server 4.x\n\n# Soap Data Source\n\n## Install\n\n```\nnpm install --save apollo-dataSource-soap\n```\n\nor\n\n```\nyarn add apollo-dataSource-soap\n```\n\n## Usage\n\nDefine a data source by extending the `SOAPDataSource` class. You can invoke the soap method with param by invoking `invoke` method.\n\nThe cache can be initialized as specified in [apollo migration 4 guide]\n\n```\nclass TestSoapDataSource extends SOAPDataSource {\n  constructor() {\n    // pass the cache as per your requirement\n    super('http://www.thomas-bayer.com/axis2/services/BLZService?wsdl', {cache: new InMemoryLRUCache\u003cstring, any\u003e()});\n  }\n\n  async willSendRequest(options) {\n    // override the soap endpoint for all requests\n    options.endpoint = 'http://www.thomas-bayer.com/axis2/services/BLZService';\n    // these will be used for all soap calls\n    options.wsdl_headers = {\n      Authorization: token,\n    }\n  }\n\n  async getBank() {\n    return await this.invoke('getBank', {blz: 37050198});\n  }\n}\n```\n\n# SOAP Cache utility\n\nSOAP is sent as HTTP POST and its a non-idempotent. Thus it can not be cached at HTTP level.\n\n[This][4] is draft verison of document for response caching for SOAP, but did not found any implementaion of it.\n\nThus it make sense to client decide to cache it or not and for how much duration.\n\nSpecify the ttl to cache the SOAP response.\n\n```\nclass TestSoapDataSource extends SOAPDataSource {\n  constructor() {\n    // pass the cache as per your requirement\n    super('http://www.thomas-bayer.com/axis2/services/BLZService?wsdl', {cache: new InMemoryLRUCache\u003cstring, any\u003e()});\n  }\n\n  async willSendRequest(options) {\n    // override the soap endpoint for all requests\n    options.endpoint = 'http://www.thomas-bayer.com/axis2/services/BLZService';\n    // these will be used for all soap calls\n    options.wsdl_headers = {\n      Authorization: token,\n    }\n  }\n\n  async getBank() {\n    // cache the response for 1 hour\n    return await this.invoke('getBank', {blz: 37050198}, {ttl: 3600});\n  }\n}\n```\n\n## Decide when to cache\n\nThere might be a situation where client needs to decide the response should be cached based on response code. This can be achieved overriding the method `shouldCache` method. `shouldCache` method returns a `boolean` flag to indicate if response can be cached or not. Please take a look at below example:\n\n```\nclass TestSoapDataSource extends SOAPDataSource {\n  constructor() {\n    // pass the cache as per your requirement\n    super('http://www.thomas-bayer.com/axis2/services/BLZService?wsdl', {cache: new InMemoryLRUCache\u003cstring, any\u003e()});\n  }\n\n  async willSendRequest(options) {\n    // override the soap endpoint for all requests\n    options.endpoint = 'http://www.thomas-bayer.com/axis2/services/BLZService';\n    // these will be used for all soap calls\n    options.wsdl_headers = {\n      Authorization: token,\n    }\n  }\n\n  async getBank() {\n    // cache the response for 1 hour\n    return await this.invoke('getBank', {blz: 37050198}, {ttl: 3600});\n  }\n\n  shouldCache(response) {\n    return response.code === 0 ? true : false;\n  }\n}\n```\n\n# Issue or need a new feature?\n\nIf you are experiencing a issue or wanted to add a new feature, please create a github issue [here][2].\n\n# Contributing\n\n:star: Star me on GitHub — it helps!\n\n:heart: contribution: Here is [contributing guide][3] in deatil.\n\nFor impatient here are quick steps:\n\n- **Fork** the repository\n- Create **Branch** in you local repository\n- while(youFinish) { **Commit** }\n- **Squash** related commits.\n- **Write** unit test cases for your work.\n- Check the **Build** on your local.\n- Raise a **Pull Request** (aka PR)\n\n[1]: https://www.apollographql.com/docs/apollo-server/features/data-sources.html\n[2]: https://github.com/RishikeshDarandale/apollo-datasource-soap/issues/new\n[3]: ./CONTRIBUTING.md\n[4]: https://lists.w3.org/Archives/Public/www-ws/2001Aug/att-0000/ResponseCache.html\n[5]: https://www.apollographql.com/docs/apollo-server/migration#datasources\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishikeshdarandale%2Fapollo-datasource-soap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishikeshdarandale%2Fapollo-datasource-soap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishikeshdarandale%2Fapollo-datasource-soap/lists"}