-
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): support SOAP headers and customize aliases (#8196)
* feat(soap): support SOAP headers * chore(dependencies): updated changesets for modified dependencies * More * Go * No fetch for header test * More * chore(dependencies): updated changesets for modified dependencies * chore(dependencies): updated changesets for modified dependencies * lets go * Tests * Hmm * Go * Envelopeee * Leftover * Docs * Headers * Body alias documentation * Lockfile --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
b113b5e
commit 3fc1f3e
Showing
24 changed files
with
937 additions
and
52 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,5 @@ | ||
--- | ||
"@omnigraph/soap": patch | ||
--- | ||
dependencies updates: | ||
- Added dependency [`@graphql-mesh/transport-common@^0.7.25` ↗︎](https://www.npmjs.com/package/@graphql-mesh/transport-common/v/0.7.25) (to `dependencies`) |
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,75 @@ | ||
--- | ||
'@graphql-mesh/transport-soap': patch | ||
'@omnigraph/soap': patch | ||
'@graphql-mesh/types': patch | ||
--- | ||
|
||
- You can now choose the name of the alias you want to use for SOAP body; | ||
|
||
```ts filename="mesh.config.ts" {4} | ||
import { defineConfig } from '@graphql-mesh/compose-cli' | ||
|
||
export const composeConfig = defineConfig({ | ||
sources: [ | ||
{ | ||
sourceHandler: loadSOAPSubgraph('CountryInfo', { | ||
source: | ||
'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL', | ||
bodyAlias: 'my-body' | ||
}) | ||
} | ||
] | ||
}) | ||
``` | ||
|
||
- Then it will generate a body like below by using the alias; | ||
|
||
```xml | ||
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:my-body="http://foo.com/"> | ||
<soap:Body> | ||
<my-body:Foo> | ||
<my-body:Bar>baz</my-body:Bar> | ||
</my-body:Foo> | ||
</soap:Body> | ||
</soap:Envelope> | ||
``` | ||
|
||
If you want to add SOAP headers to the request body like below; | ||
|
||
```xml | ||
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:header="http://foo.com/"> | ||
<soap:Header> | ||
<header:MyHeader> | ||
<header:UserName>user</header:UserName> | ||
<header:Password>password</header:Password> | ||
</header:MyHeader> | ||
</soap:Header> | ||
``` | ||
|
||
You can add the headers to the configuration like below; | ||
|
||
```ts filename="mesh.config.ts" {2,7-9} | ||
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', | ||
soapHeaders: { | ||
alias: 'header', | ||
namespace: 'http://foo.com', | ||
headers: { | ||
MyHeader: { | ||
UserName: 'user', | ||
Password: 'password' | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
] | ||
}) | ||
``` |
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
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.