diff --git a/.gitignore b/.gitignore index 501eefdb..681b9be9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ lib .idea *.iml .vscode -.eslintrc \ No newline at end of file +.eslintrc +.DS_Store + diff --git a/src/parser/wsdl/operation.js b/src/parser/wsdl/operation.js index 6199ef44..95c02262 100644 --- a/src/parser/wsdl/operation.js +++ b/src/parser/wsdl/operation.js @@ -21,6 +21,7 @@ class Operation extends WSDLElement { //there can be multiple faults defined in the operation. They all will have same type name 'fault' //what differentiates them from each other is, the element/s which will get added under fault <detail> during runtime. this.faults = []; + this.soapVersion; } addChild(child) { @@ -37,6 +38,14 @@ class Operation extends WSDLElement { case 'operation': // soap:operation this.soapAction = child.$soapAction || ''; this.style = child.$style || ''; + //figure out from the binding operation soap version 1.1 or 1.2 + if (child.$soapAction !== undefined){ + if(child.nsURI === 'http://schemas.xmlsoap.org/wsdl/soap/'){ + this.soapVersion ='1.1'; + } else if(child.nsURI === 'http://schemas.xmlsoap.org/wsdl/soap12/') { + this.soapVersion ='1.2'; + } + } break; } } @@ -187,6 +196,7 @@ class Operation extends WSDLElement { name: this.$name, style: this.mode, soapAction: this.soapAction, + soapVersion: this.soapVersion, input: { body: input, headers: inputHeaders @@ -204,12 +214,12 @@ class Operation extends WSDLElement { this.descriptor.outputEnvelope = Operation.createEnvelopeDescriptor(this.descriptor.output, true); this.descriptor.faultEnvelope = - Operation.createEnvelopeDescriptor(this.descriptor.faults, true); + Operation.createEnvelopeDescriptor(this.descriptor.faults, true, this.soapVersion); return this.descriptor; } - static createEnvelopeDescriptor(parameterDescriptor, isOutput, prefix, nsURI) { + static createEnvelopeDescriptor(parameterDescriptor, isOutput, soapVersion, prefix, nsURI) { prefix = prefix || 'soap'; nsURI = nsURI || 'http://schemas.xmlsoap.org/soap/envelope/'; var descriptor = new TypeDescriptor(); @@ -237,41 +247,41 @@ class Operation extends WSDLElement { bodyDescriptor.add(parameterDescriptor.headers); } - //process faults. An example of resulting structure of the <Body> element with <Fault> element descriptor: + //process faults. An example of resulting structure of the <Body> element with soap 1.1 <Fault> element descriptor: /* - <Body> - <Fault> - <faultcode> </faultcode> - <faultstring> </faultstring> - <faultactor> </faultactor> - <detail> - <myMethodFault1> - <errorMessage1> </errorMessage1> - <value1> </value1> - </myMethodFault1> - </detail> + <soap:Body> + <soap:Fault> + <faultcode>sampleFaultCode</faultcode> + <faultstring>sampleFaultString</faultstring> <detail> - <myMethodFault2> - <errorMessage2> </errorMessage2> - <value2> </value2> - </myMethodFault2> + <ns1:myMethodFault1 xmlns:ns1="http://example.com/doc_literal_wrapped_test.wsdl"> + <errorMessage1>MyMethod Business Exception message</errorMessage1> + <value1>10</value1> + </ns1:myMethodFault1> </detail> - </Fault> - </Body> + </soap:Fault> + </soap:Body> */ if (isOutput && parameterDescriptor && parameterDescriptor.body.Fault) { let xsdStr = new QName(helper.namespaces.xsd, 'string', 'xsd'); + var form; + if (soapVersion === '1.1') { + form = 'unqualified'; + } else if (soapVersion === '1.2') { + form = 'qualified'; + } + let faultDescriptor = new ElementDescriptor( new QName(nsURI, 'Fault', prefix), null, 'qualified', false); bodyDescriptor.add(faultDescriptor); faultDescriptor.add( - new ElementDescriptor(new QName(nsURI, 'faultcode', prefix), null, 'qualified', false)); + new ElementDescriptor(new QName(nsURI, 'faultcode', prefix), null, form, false)); faultDescriptor.add( - new ElementDescriptor(new QName(nsURI, 'faultstring', prefix), null, 'qualified', false)); + new ElementDescriptor(new QName(nsURI, 'faultstring', prefix), null, form, false)); faultDescriptor.add( - new ElementDescriptor(new QName(nsURI, 'faultactor', prefix), null, 'qualified', false)); + new ElementDescriptor(new QName(nsURI, 'faultactor', prefix), null, form, false)); let detailDescriptor = - new ElementDescriptor(new QName(nsURI, 'detail', prefix), null, 'qualified', false); + new ElementDescriptor(new QName(nsURI, 'detail', prefix), null, form, false); //multiple faults may be defined in wsdl for this operation. Go though every Fault and add it under <detail> element. for (var f in parameterDescriptor.body.Fault.faults) { diff --git a/test/wsdl-test.js b/test/wsdl-test.js index 08a6f3d6..26a928e6 100644 --- a/test/wsdl-test.js +++ b/test/wsdl-test.js @@ -73,15 +73,17 @@ describe('wsdl-tests', function() { }); it('should handle element ref', function (done) { - var expectedMsg = '<ns1:fooRq xmlns:ns1="http://example.com/bar/xsd"' + - ' xmlns="http://example.com/bar/xsd"><bar1:paymentRq' + - ' xmlns:bar1="http://example.com/bar1/xsd">' + - '<bar1:bankSvcRq>' + - '<bar1:requestUID>001</bar1:requestUID></bar1:bankSvcRq>' + - '</bar1:paymentRq></ns1:fooRq>'; + var expectedMsg = '<soap:Body>\n '+ + '<ns2:fooRq xmlns:ns2=\"http://example.com/bar/xsd\">\n '+ + '<ns3:paymentRq xmlns:ns3=\"http://example.com/bar1/xsd\">\n '+ + '<ns3:bankSvcRq>\n '+ + '<ns3:requestUID>001</ns3:requestUID>\n '+ + '</ns3:bankSvcRq>\n '+ + '</ns3:paymentRq>\n '+ + '</ns2:fooRq>\n</soap:Body>\n'; soap.createClient(__dirname + '/wsdl/elementref/foo.wsdl', {strict: true}, function(err, client) { assert.ok(!err); - client.fooOp({paymentRq: {bankSvcRq: {requestUID: '001'}}}, function(err, result) { + client.fooOp({fooRq: {paymentRq: {bankSvcRq: {requestUID: '001'}}}}, function(err, result) { assert.equal(client.lastMessage, expectedMsg); done(); }); @@ -101,29 +103,30 @@ describe('wsdl-tests', function() { }); it('should get empty namespace prefix', function (done) { - var expectedMsg = '<ns1:fooRq xmlns:ns1="http://example.com/bar/xsd"' + - ' xmlns="http://example.com/bar/xsd"><bar1:paymentRq' + - ' xmlns:bar1="http://example.com/bar1/xsd">' + - '<bar1:bankSvcRq>' + - '<requestUID>001</requestUID></bar1:bankSvcRq>' + - '</bar1:paymentRq></ns1:fooRq>'; - // var expectedMsg = 'gg'; - + var expectedMsg = '<soap:Body>\n '+ + '<ns2:fooRq xmlns:ns2=\"http://example.com/bar/xsd\">\n '+ + '<ns3:paymentRq xmlns:ns3=\"http://example.com/bar1/xsd\">\n '+ + '<ns3:bankSvcRq>\n '+ + '<RequestUID>001</RequestUID>\n '+ + '</ns3:bankSvcRq>\n '+ + '</ns3:paymentRq>\n '+ + '</ns2:fooRq>\n</soap:Body>\n'; soap.createClient(__dirname + '/wsdl/elementref/foo.wsdl', {strict: true}, function(err, client) { assert.ok(!err); - client.fooOp({paymentRq: {bankSvcRq: {':requestUID': '001'}}}, function(err, result) { + client.fooOp({fooRq:{paymentRq: {bankSvcRq: {'RequestUID': '001'}}}}, function(err, result) { assert.equal(client.lastMessage, expectedMsg); done(); }); }); }); - + //revisit - If client class is modified, client.describe() will change.. hence, do we need this test? it('should load same namespace from included xsd', function (done) { - var expected = '{"DummyService":{"DummyPortType":{"Dummy":{"input":{"ID":"IdType|xs:string|pattern","Name":"NameType|xs:string|minLength,maxLength"},"output":{"Result":"dummy:DummyList"}}}}}'; + var expected = '{\"DummyService\":{\"DummyPortType\":{\"Dummy\":{\"name\":\"Dummy\",\"style\":\"documentLiteral\",\"soapAction\":\"tns#Dummy\",\"soapVersion\":\"1.1\",\"input\":{\"body\":{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}},{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyRequest\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[]},\"headers\":{\"elements\":[],\"attributes\":[]}},\"output\":{\"body\":{\"elements\":[{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"typeDescriptor\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"name\":\"DummyList\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyResponse\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[]},\"headers\":{\"elements\":[],\"attributes\":[]}},\"faults\":{\"body\":{\"Fault\":{\"faults\":{}}}},\"inputEnvelope\":{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}},{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyRequest\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"ID\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"IdType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}},{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Name\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"NameType\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyRequest\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}}],\"attributes\":[]},\"outputEnvelope\":{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"typeDescriptor\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"name\":\"DummyList\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyResponse\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"Result\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"DummyList\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"typeDescriptor\":{\"elements\":[{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":true,\"isSimple\":true,\"refOriginal\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"dummy\"},\"type\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"Dummy\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":true,\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"typeDescriptor\":{\"elements\":[],\"attributes\":[{\"qname\":{\"nsURI\":\"http://www.dummy.com/Types\",\"name\":\"language\"},\"type\":{\"nsURI\":\"http://www.w3.org/2001/XMLSchema\",\"name\":\"language\"},\"form\":\"unqualified\"}],\"extension\":{\"name\":\"string\",\"xmlns\":\"\",\"isSimple\":true},\"name\":\"Dummy\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"name\":\"DummyList\",\"xmlns\":\"http://www.dummy.com/Types\",\"isSimple\":false}}}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://www.dummy.com\",\"name\":\"DummyResponse\"},\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}}],\"attributes\":[]},\"faultEnvelope\":{\"elements\":[{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false,\"refOriginal\":{\"elements\":[{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Header\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false},{\"elements\":[],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Body\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}],\"attributes\":[],\"qname\":{\"nsURI\":\"http://schemas.xmlsoap.org/soap/envelope/\",\"name\":\"Envelope\",\"prefix\":\"soap\"},\"type\":null,\"form\":\"qualified\",\"isMany\":false,\"isSimple\":false}}],\"attributes\":[]}}}}}'; soap.createClient(__dirname + '/wsdl/xsdinclude/xsd_include.wsdl', function(err, client) { assert.ok(!err); - assert.equal(JSON.stringify(client.describe()), expected); + var result = JSON.stringify(client.describe()); + assert.equal(result, expected); done(); }); }); diff --git a/test/wsdl/typeref/request.json b/test/wsdl/typeref/request.json index 7177d08d..6b21c27d 100644 --- a/test/wsdl/typeref/request.json +++ b/test/wsdl/typeref/request.json @@ -1,15 +1,17 @@ { - "itemRq": { - "ecomRq": { - "rqUID": "001" - }, - "item": { - "qty": 100, - "itemId": "item01" - }, - "backupItem": { - "qty": 50, - "itemId": "item02" + "orderRq": { + "itemRq": { + "ecomRq": { + "rqUID": "001" + }, + "item": { + "qty": 100, + "itemId": "item01" + }, + "backupItem": { + "qty": 50, + "itemId": "item02" + } } } } diff --git a/test/wsdl/typeref/request.xml.js b/test/wsdl/typeref/request.xml.js index 8d19de67..69c31a6a 100755 --- a/test/wsdl/typeref/request.xml.js +++ b/test/wsdl/typeref/request.xml.js @@ -1,6 +1,18 @@ -module.exports = '<ns1:orderRq xmlns:ns1="http://example.org/ns1" xmlns="http://example.org/ns1">' + - '<ns1:itemRq><ns1:ecomRq><ns2:rqUID xmlns:ns2="http://example.org/ns2">001</ns2:rqUID>' + - '</ns1:ecomRq><ns1:item><qty>100</qty>' + - '<ns2:itemId xmlns:ns2="http://example.org/ns2">item01</ns2:itemId></ns1:item>' + - '<ns2:backupItem xmlns:ns2="http://example.org/ns2"><qty>50</qty>' + - '<ns2:itemId>item02</ns2:itemId></ns2:backupItem></ns1:itemRq></ns1:orderRq>'; +module.exports = + '<soap:Body>\n '+ + '<ns2:orderRq xmlns:ns2=\"http://example.org/ns1\">\n '+ + '<ns2:itemRq>\n '+ + '<ns2:ecomRq>\n '+ + '<ns3:rqUID xmlns:ns3=\"http://example.org/ns2\">001</ns3:rqUID>\n '+ + '</ns2:ecomRq>\n '+ + '<ns2:item>\n '+ + '<qty>100</qty>\n '+ + '<ns3:itemId xmlns:ns3=\"http://example.org/ns2\">item01</ns3:itemId>\n '+ + '</ns2:item>\n '+ + '<ns3:backupItem xmlns:ns3=\"http://example.org/ns2\">\n '+ + '<qty>50</qty>\n '+ + '<ns3:itemId>item02</ns3:itemId>\n '+ + '</ns3:backupItem>\n '+ + '</ns2:itemRq>\n '+ + '</ns2:orderRq>\n'+ + '</soap:Body>\n';