-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(soap): auto detection of SOAP namespace, and allow to customize it
- Loading branch information
Showing
15 changed files
with
182 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
'@graphql-mesh/transport-soap': minor | ||
'@omnigraph/soap': minor | ||
--- | ||
|
||
Auto detection of SOAP version to decide SOAP namespace; | ||
For SOAP 1.1, it is set to `http://schemas.xmlsoap.org/soap/envelope/` and for SOAP 1.2, it is set to `http://www.w3.org/2003/05/soap-envelope`. | ||
|
||
If you want to use a custom namespace, you can set it like below; | ||
|
||
```ts | ||
import { defineConfig } from '@graphql-mesh/compose-cli' | ||
import { loadSOAPSubgraph } from '@omnigraph/soap' | ||
|
||
export const composeConfig = defineConfig({ | ||
subgraphs: [ | ||
{ | ||
sourceHandler: loadSOAPSubgraph('CountryInfo', { | ||
source: | ||
'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL', | ||
soapNamespace: 'http://foo.com/schemas/soap/envelope' | ||
}) | ||
} | ||
] | ||
}) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { basename, join } from 'path'; | ||
import { lexicographicSortSchema } from 'graphql'; | ||
import { findAndParseConfig } from '@graphql-mesh/cli'; | ||
import { ProcessedConfig } from '@graphql-mesh/config'; | ||
import { getMesh, MeshInstance } from '@graphql-mesh/runtime'; | ||
import { InMemoryStoreStorageAdapter, MeshStore } from '@graphql-mesh/store'; | ||
import { printSchemaWithDirectives } from '@graphql-tools/utils'; | ||
import { inspect } from 'util'; | ||
|
||
describe('SOAP Demo', () => { | ||
let mesh: MeshInstance; | ||
let config: ProcessedConfig; | ||
beforeAll(async () => { | ||
const store = new MeshStore('soap', new InMemoryStoreStorageAdapter(), { | ||
readonly: false, | ||
validate: false, | ||
}); | ||
config = await findAndParseConfig({ | ||
dir: join(__dirname, '..'), | ||
store, | ||
}); | ||
mesh = await getMesh(config); | ||
}); | ||
it('should generate correct schema', async () => { | ||
expect(printSchemaWithDirectives(lexicographicSortSchema(mesh.schema))).toMatchSnapshot( | ||
'soap-demo-schema', | ||
); | ||
}); | ||
it('should give correct response for example queries', async () => { | ||
for (const source of config.documents) { | ||
if (!source.document || !source.location) { | ||
throw new Error(`Invalid document config: ${inspect(source)}`); | ||
} | ||
const result = await mesh.execute(source.document); | ||
expect(result.errors).toBeUndefined(); | ||
expect(result).toMatchSnapshot(basename(source.location) + '-soap-demo-result'); | ||
} | ||
}); | ||
afterAll(() => mesh?.destroy?.()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.