Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also handle the case where the WSDL has two bindings. #134

Merged
1 commit merged into from
Jan 22, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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