Skip to content

Commit

Permalink
Merge pull request #346 from justcfx2u/master
Browse files Browse the repository at this point in the history
Consolidate commit, intended to supersede #208 PR.
  • Loading branch information
jsdevel committed May 11, 2014
2 parents 2e7bb8c + 36d497f commit 95e43b6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/wsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,9 @@ var WSDL = function(definition, uri, options) {
var bindings = self.definitions.bindings;
for (var bindingName in bindings) {
var binding = bindings[bindingName];
if (typeof binding.style === 'undefined') {
binding.style = 'document';
}
if (binding.style !== 'document')
continue;
var methods = binding.methods;
Expand Down
10 changes: 10 additions & 0 deletions test/client-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ describe('SOAP Client', function() {
});
assert(!called);
});

it('should set binding style to "document" by default if not explicitly set in WSDL, per SOAP spec', function (done) {
soap.createClient(__dirname+'/wsdl/binding_document.wsdl', function(err, client) {
assert.ok(client);
assert.ok(!err);

assert.ok(client.wsdl.definitions.bindings.mySoapBinding.style === 'document');
done();
});
});

describe('Extra headers in request and last response', function() {
var server = null;
Expand Down
12 changes: 12 additions & 0 deletions test/wsdl/binding_document.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="myAPI">
<portType name="mySoapPort" />
<binding name="mySoapBinding" type="wsdlns:mySoapPort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
</binding>
<service name="myAPI">
<port name="mySoapPort" binding="wsdlns:mySoapBinding">
<soap:address location="http://test" />
</port>
</service>
</definitions>

0 comments on commit 95e43b6

Please sign in to comment.