Skip to content

Commit

Permalink
Also handle the case where the WSDL has two bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Kingdon committed Jan 18, 2011
1 parent 76ea08a commit 4f98479
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/savon/wsdl/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def tag_end(tag)
# no soapAction attribute found till now
operation_from tag, "soapAction" => @input
end

@section = :definitions if Sections.include?(tag) && depth <= 1
end

# Stores available operations from a given tag +name+ and +attrs+.
Expand Down
25 changes: 25 additions & 0 deletions spec/fixtures/wsdl/two_bindings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example of a WSDL with two <binding> tags ("sections" in Savon
parlance).
This is stripped down from a real example found in the wild, although
having different operations for the SOAP 1.1 and SOAP 1.2 bindings
is hypothetical (the real-world example I saw had the same operations
in each binding section). -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<types>
</types>
<portType name="BlogSoap">
</portType>
<binding name="BlogSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="Post" />
<operation name="Post11only" />
</binding>
<binding name="BlogSoap12">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="Post" />
<operation name="Post12only" />
</binding>
</definitions>

9 changes: 9 additions & 0 deletions spec/savon/wsdl/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
end
end

context "with two_bindings.xml" do
let(:parser) { new_parser :two_bindings }

it "should merge operations from all binding sections (until we have an example where it makes sense to do otherwise)" do
parser.operations.keys.map(&:to_s).sort.should ==
%w{post post11only post12only}
end
end

RSpec::Matchers.define :match_operations do |expected|
match do |actual|
actual.should have(expected.keys.size).items
Expand Down

0 comments on commit 4f98479

Please sign in to comment.