0

I have upgraded graphql-mesh/soap versions and other dependencies. And my soap wsdl is using soap1.1 features.

After update I am unable to connect to soap client as it is returning 500 error due to version mismatch in namespace created by graphqlmesh soap in request.

I have configured soap handler in .meshrc.yaml with source url

Expected namespace in request body -http://schemas.xmlsoap.org/soap/envelope

And generating - http://www.w3.org/2003/05/soap-envelope

0

1 Answer 1

0

Manage to modify the namespace using custome-fect.

sources:
  - name: myser
    handler:
      soap:
        source: http://127.0.0.1:8080/myser.wsdl
        operationHeaders:
          Content-Type: text/xml;charset=utf-8
          Accept-Encoding: gzip,deflate   
customFetch: ./custom-fetch.ts     
serve:
  endpoint: /api/graphql 
  port: 5000

my custom -fetch.js

import { fetch } from '@whatwg-node/fetch'
 
export default async function ( url: string, options: RequestInit = {} )
{
    console.log(url)
    if ( url === 'http://127.0.0.1:8080/myserv' )
    {
        console.log(options.body)
        if (options.body && typeof options.body === 'string')
        {
            let body = options.body;
            if (typeof body === 'string') {
                body = body.replace(
                  '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">',
                  '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >'
                );
        

                options.body = body;
                console.log('Modified xml body:', options.body);
            }        
        }
    }
    
    return fetch(url, options);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.