From 23327f1dd3e406a4bab023f8177a32131e0ae959 Mon Sep 17 00:00:00 2001 From: Vinayak Mohite Date: Fri, 7 Jun 2024 21:52:25 +0530 Subject: [PATCH] Allow SOAP client creation even if some of message definition are missing --- src/wsdl/elements.ts | 16 ++++--- test/wsdl-test.js | 8 ++++ test/wsdl/missing_message_definition.wsdl | 57 +++++++++++++++++++++++ 3 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 test/wsdl/missing_message_definition.wsdl diff --git a/src/wsdl/elements.ts b/src/wsdl/elements.ts index dbd222678..8349d8b12 100644 --- a/src/wsdl/elements.ts +++ b/src/wsdl/elements.ts @@ -872,14 +872,16 @@ export class OperationElement extends Element { } const messageName = splitQName(child.$message).name; const message = definitions.messages[messageName]; - message.postProcess(definitions); - if (message.element) { - definitions.messages[message.element.$name] = message; - this[child.name] = message.element; - } else { - this[child.name] = message; + if (message) { + message.postProcess(definitions); + if (message.element) { + definitions.messages[message.element.$name] = message; + this[child.name] = message.element; + } else { + this[child.name] = message; + } + children.splice(i--, 1); } - children.splice(i--, 1); } this.deleteFixedAttrs(); } diff --git a/test/wsdl-test.js b/test/wsdl-test.js index 49fee457c..fa041785c 100644 --- a/test/wsdl-test.js +++ b/test/wsdl-test.js @@ -330,4 +330,12 @@ describe('WSDL Parser (non-strict)', () => { done(); }); }); + + + it('Should create client even if the some of message definitions are missing', function (done) { + soap.createClient(__dirname+'/wsdl/missing_message_definition.wsdl', function(err, client) { + assert.equal(err, null); + done(); + }); + }); }); diff --git a/test/wsdl/missing_message_definition.wsdl b/test/wsdl/missing_message_definition.wsdl new file mode 100644 index 000000000..6ca372f03 --- /dev/null +++ b/test/wsdl/missing_message_definition.wsdl @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +