Skip to content

Commit

Permalink
Body alias documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Jan 6, 2025
1 parent d0cfd57 commit 8e6ad9e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
25 changes: 25 additions & 0 deletions website/src/pages/docs/handlers/soap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,31 @@ sources:
Password: password
```
## Body Alias
You can now choose the name of the alias you want to use for SOAP body;
```yaml filename=".meshrc.yaml" {4}
sources:
- name: CountryInfo
handler:
soap:
source: ...
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>
```

## CodeSandBox Example

You can check out our example that uses SOAP Handler.
Expand Down
34 changes: 34 additions & 0 deletions website/src/pages/v1/source-handlers/soap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const composeConfig = defineConfig({
source:
'http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL',
soapHeaders: {
// The name of the alias to be used in the envelope for header components
alias: 'header',
namespace: 'http://foo.com',
headers: {
Expand All @@ -85,3 +86,36 @@ export const composeConfig = defineConfig({
[You can find a working example here](
https://github.com/ardatan/graphql-mesh/tree/main/examples/v1-next/soap-demo )
</Callout>

## Custom Body Alias

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'
import { loadSOAPSubgraph } from '@omnigraph/soap'

export const composeConfig = defineConfig({
subgraphs: [
{
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>
```

0 comments on commit 8e6ad9e

Please sign in to comment.