How to use the soap.WSDL function in soap

To help you get started, we’ve selected a few soap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bbyars / mountebank / src / models / soap / wsdl.js View on Github external
function createBodyFor (options) {
        var wsdl = new WSDL(xml, null, {}),
            deferred = Q.defer();

        wsdl.onReady(function () {
            var service = wsdl.services[Object.keys(wsdl.services)[0]],
                port = service.ports[Object.keys(service.ports)[0]],
                method = port.binding.methods[options.request.method.name],
                output = method.output,
                responseName = options.namespacePrefix + ':' + output.$name,
                responseFields = output.parts,
                body = util.format('<%s>', responseName),
                response = options.stub.response || {};

            Object.keys(responseFields).forEach(function (fieldName) {
                var fieldValue = response[fieldName] || '';
                body += util.format('<%s>%s', fieldName, fieldValue, fieldName);
            });