wasabi 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ ## 2.5.1 (2012-08-22)
2
+
3
+ * Fix: [#14](https://github.com/rubiii/wasabi/issues/14) fixes an issue where
4
+ finding the correct SOAP input tag and namespace identifier fails when portTypes
5
+ are imported, since imports are currently not supported.
6
+
7
+ The bug was introduced in v2.2.0 by [583cf6](https://github.com/rubiii/wasabi/commit/583cf658f1953411a7a7a4c22923fa0a046c8d6d).
8
+
9
+ * Refactoring: Removed `Object#blank?` core extension.
10
+
1
11
  ## 2.5.0 (2012-06-28)
2
12
 
3
13
  * Fix: [#10](https://github.com/rubiii/wasabi/issues/10) fixes an issue where
@@ -1,6 +1,5 @@
1
1
  require "uri"
2
2
  require "wasabi/xpath_helper"
3
- require "wasabi/core_ext/object"
4
3
  require "wasabi/core_ext/string"
5
4
 
6
5
  module Wasabi
@@ -86,7 +85,7 @@ module Wasabi
86
85
 
87
86
  if soap_action
88
87
  soap_action = soap_action.to_s
89
- action = soap_action.blank? ? name : soap_action
88
+ action = soap_action && !soap_action.empty? ? soap_action : name
90
89
 
91
90
  # There should be a matching portType for each binding, so we will lookup the input from there.
92
91
  namespace_id, input = input_for(operation)
@@ -129,9 +128,7 @@ module Wasabi
129
128
  if @types[base]
130
129
  @types[name].merge! @types[base]
131
130
  else
132
- deferred_types << Proc.new do
133
- @types[name].merge! @types[base]
134
- end
131
+ deferred_types << Proc.new { @types[name].merge! @types[base] }
135
132
  end
136
133
  end
137
134
  end
@@ -153,22 +150,28 @@ module Wasabi
153
150
  binding_type = at_xpath(operation, "../@type").to_s.split(':').last
154
151
  port_type_input = at_xpath(operation, "../../wsdl:portType[@name='#{binding_type}']/wsdl:operation[@name='#{operation_name}']/wsdl:input")
155
152
 
156
- port_message_ns_id, port_message_type = port_type_input.attribute("message").to_s.split(':')
153
+ # TODO: Stupid fix for missing support for imports.
154
+ # Sometimes portTypes are actually included in a separate WSDL.
155
+ if port_type_input
156
+ port_message_ns_id, port_message_type = port_type_input.attribute("message").to_s.split(':')
157
157
 
158
- message_ns_id, message_type = nil
158
+ message_ns_id, message_type = nil
159
159
 
160
- # TODO: Support multiple 'part' elements in the message.
161
- if (port_message_part = at_xpath(port_type_input, "../../../wsdl:message[@name='#{port_message_type}']/wsdl:part[1]"))
162
- if (port_message_part_element = port_message_part.attribute("element"))
163
- message_ns_id, message_type = port_message_part_element.to_s.split(':')
160
+ # TODO: Support multiple 'part' elements in the message.
161
+ if (port_message_part = at_xpath(port_type_input, "../../../wsdl:message[@name='#{port_message_type}']/wsdl:part[1]"))
162
+ if (port_message_part_element = port_message_part.attribute("element"))
163
+ message_ns_id, message_type = port_message_part_element.to_s.split(':')
164
+ end
164
165
  end
165
- end
166
166
 
167
- # Fall back to the name of the binding operation
168
- if message_type
169
- [message_ns_id, message_type]
167
+ # Fall back to the name of the binding operation
168
+ if message_type
169
+ [message_ns_id, message_type]
170
+ else
171
+ [port_message_ns_id, operation_name]
172
+ end
170
173
  else
171
- [port_message_ns_id, operation_name]
174
+ [nil, operation_name]
172
175
  end
173
176
  end
174
177
 
@@ -1,5 +1,5 @@
1
1
  module Wasabi
2
2
 
3
- VERSION = "2.5.0"
3
+ VERSION = "2.5.1"
4
4
 
5
5
  end
@@ -0,0 +1,86 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- reference: savon issue #313 -->
3
+ <wsdl:definitions name="BYDExchangeServer" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://bydexchange.nbs-us.com" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
4
+ <wsdl:import namespace="http://bydexchange.nbs-us.com" location="http://bydexchange.nbs-us.com/BYDExchangeServer.svc?wsdl=wsdl0"/>
5
+ <wsdl:types/>
6
+ <wsdl:binding name="BasicHttpBinding_IBYDExchangeServer" type="i0:IBYDExchangeServer">
7
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
8
+ <wsdl:operation name="ProductAvail">
9
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/ProductAvail" style="document"/>
10
+ <wsdl:input>
11
+ <soap:body use="literal"/>
12
+ </wsdl:input>
13
+ <wsdl:output>
14
+ <soap:body use="literal"/>
15
+ </wsdl:output>
16
+ </wsdl:operation>
17
+ <wsdl:operation name="listcustomers">
18
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/listcustomers" style="document"/>
19
+ <wsdl:input>
20
+ <soap:body use="literal"/>
21
+ </wsdl:input>
22
+ <wsdl:output>
23
+ <soap:body use="literal"/>
24
+ </wsdl:output>
25
+ </wsdl:operation>
26
+ <wsdl:operation name="ParseCSV">
27
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/ParseCSV" style="document"/>
28
+ <wsdl:input>
29
+ <soap:body use="literal"/>
30
+ </wsdl:input>
31
+ <wsdl:output>
32
+ <soap:body use="literal"/>
33
+ </wsdl:output>
34
+ </wsdl:operation>
35
+ <wsdl:operation name="AddOrder">
36
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/AddOrder" style="document"/>
37
+ <wsdl:input>
38
+ <soap:body use="literal"/>
39
+ </wsdl:input>
40
+ <wsdl:output>
41
+ <soap:body use="literal"/>
42
+ </wsdl:output>
43
+ </wsdl:operation>
44
+ <wsdl:operation name="GetOrder">
45
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/GetOrder" style="document"/>
46
+ <wsdl:input>
47
+ <soap:body use="literal"/>
48
+ </wsdl:input>
49
+ <wsdl:output>
50
+ <soap:body use="literal"/>
51
+ </wsdl:output>
52
+ </wsdl:operation>
53
+ <wsdl:operation name="AddCustomer">
54
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/AddCustomer" style="document"/>
55
+ <wsdl:input>
56
+ <soap:body use="literal"/>
57
+ </wsdl:input>
58
+ <wsdl:output>
59
+ <soap:body use="literal"/>
60
+ </wsdl:output>
61
+ </wsdl:operation>
62
+ <wsdl:operation name="GetCustomer">
63
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/GetCustomer" style="document"/>
64
+ <wsdl:input>
65
+ <soap:body use="literal"/>
66
+ </wsdl:input>
67
+ <wsdl:output>
68
+ <soap:body use="literal"/>
69
+ </wsdl:output>
70
+ </wsdl:operation>
71
+ <wsdl:operation name="Authenticate">
72
+ <soap:operation soapAction="http://bydexchange.nbs-us.com/IBYDExchangeServer/Authenticate" style="document"/>
73
+ <wsdl:input>
74
+ <soap:body use="literal"/>
75
+ </wsdl:input>
76
+ <wsdl:output>
77
+ <soap:body use="literal"/>
78
+ </wsdl:output>
79
+ </wsdl:operation>
80
+ </wsdl:binding>
81
+ <wsdl:service name="BYDExchangeServer">
82
+ <wsdl:port name="BasicHttpBinding_IBYDExchangeServer" binding="tns:BasicHttpBinding_IBYDExchangeServer">
83
+ <soap:address location="http://bydexchange.nbs-us.com/BYDExchangeServer.svc"/>
84
+ </wsdl:port>
85
+ </wsdl:service>
86
+ </wsdl:definitions>
@@ -4,23 +4,21 @@ describe Wasabi::Document do
4
4
 
5
5
  subject { Wasabi::Document.new fixture(:authentication).read }
6
6
 
7
- describe ".new" do
8
- it "accepts a URL" do
9
- HTTPI.expects(:get).returns(HTTPI::Response.new(200, {}, "wsdl"))
7
+ it "accepts a URL" do
8
+ HTTPI.should_receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
10
9
 
11
- document = Wasabi::Document.new("http://example.com?wsdl")
12
- document.xml.should == "wsdl"
13
- end
10
+ document = Wasabi::Document.new("http://example.com?wsdl")
11
+ document.xml.should == "wsdl"
12
+ end
14
13
 
15
- it "accepts a path" do
16
- document = Wasabi::Document.new fixture(:authentication).path
17
- document.xml.should == fixture(:authentication).read
18
- end
14
+ it "accepts a path" do
15
+ document = Wasabi::Document.new fixture(:authentication).path
16
+ document.xml.should == fixture(:authentication).read
17
+ end
19
18
 
20
- it "accepts raw XML" do
21
- document = Wasabi::Document.new fixture(:authentication).read
22
- document.xml.should == fixture(:authentication).read
23
- end
19
+ it "accepts raw XML" do
20
+ document = Wasabi::Document.new fixture(:authentication).read
21
+ document.xml.should == fixture(:authentication).read
24
22
  end
25
23
 
26
24
  describe ".validate_element_form_default!" do
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: import_port_types.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:import_port_types).read }
13
+
14
+ it "does blow up when portTypes are imported" do
15
+ get_customer = subject.operations[:get_customer]
16
+
17
+ get_customer[:input].should == "GetCustomer"
18
+ get_customer[:namespace_identifier].should be_nil
19
+ end
20
+
21
+ end
22
+ end
@@ -4,7 +4,7 @@ describe Wasabi::Resolver do
4
4
 
5
5
  describe "#xml" do
6
6
  it "resolves remote documents" do
7
- HTTPI.expects(:get).returns(HTTPI::Response.new(200, {}, "wsdl"))
7
+ HTTPI.should_receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
8
8
  xml = Wasabi::Resolver.new("http://example.com?wsdl").xml
9
9
  xml.should == "wsdl"
10
10
  end
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_development_dependency "rake", "~> 0.9"
20
20
  s.add_development_dependency "rspec", "~> 2.10"
21
- s.add_development_dependency "mocha", "~> 0.11"
22
21
 
23
22
  s.files = `git ls-files`.split("\n")
24
23
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wasabi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 5
9
- - 0
10
- version: 2.5.0
9
+ - 1
10
+ version: 2.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Harrington
@@ -15,10 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-28 00:00:00 Z
18
+ date: 2012-08-22 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ prerelease: false
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
26
  - - ~>
@@ -28,12 +30,12 @@ dependencies:
28
30
  - 1
29
31
  - 0
30
32
  version: "1.0"
33
+ version_requirements: *id001
31
34
  name: httpi
32
- type: :runtime
33
- prerelease: false
34
- requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ type: :runtime
38
+ requirement: &id002 !ruby/object:Gem::Requirement
37
39
  none: false
38
40
  requirements:
39
41
  - - ">="
@@ -44,12 +46,12 @@ dependencies:
44
46
  - 4
45
47
  - 0
46
48
  version: 1.4.0
49
+ version_requirements: *id002
47
50
  name: nokogiri
48
- type: :runtime
49
- prerelease: false
50
- requirement: *id002
51
51
  - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
53
55
  none: false
54
56
  requirements:
55
57
  - - ~>
@@ -59,12 +61,12 @@ dependencies:
59
61
  - 0
60
62
  - 9
61
63
  version: "0.9"
64
+ version_requirements: *id003
62
65
  name: rake
63
- type: :development
64
- prerelease: false
65
- requirement: *id003
66
66
  - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
68
70
  none: false
69
71
  requirements:
70
72
  - - ~>
@@ -74,25 +76,8 @@ dependencies:
74
76
  - 2
75
77
  - 10
76
78
  version: "2.10"
79
+ version_requirements: *id004
77
80
  name: rspec
78
- type: :development
79
- prerelease: false
80
- requirement: *id004
81
- - !ruby/object:Gem::Dependency
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- hash: 29
88
- segments:
89
- - 0
90
- - 11
91
- version: "0.11"
92
- name: mocha
93
- type: :development
94
- prerelease: false
95
- requirement: *id005
96
81
  description: A simple WSDL parser
97
82
  email:
98
83
  - me@rubiii.com
@@ -112,7 +97,6 @@ files:
112
97
  - README.md
113
98
  - Rakefile
114
99
  - lib/wasabi.rb
115
- - lib/wasabi/core_ext/object.rb
116
100
  - lib/wasabi/core_ext/string.rb
117
101
  - lib/wasabi/document.rb
118
102
  - lib/wasabi/parser.rb
@@ -121,6 +105,7 @@ files:
121
105
  - lib/wasabi/xpath_helper.rb
122
106
  - spec/fixtures/authentication.wsdl
123
107
  - spec/fixtures/geotrust.wsdl
108
+ - spec/fixtures/import_port_types.wsdl
124
109
  - spec/fixtures/inherited.wsdl
125
110
  - spec/fixtures/lower_camel.wsdl
126
111
  - spec/fixtures/multiple_namespaces.wsdl
@@ -134,7 +119,6 @@ files:
134
119
  - spec/fixtures/two_bindings.wsdl
135
120
  - spec/spec_helper.rb
136
121
  - spec/support/fixture.rb
137
- - spec/wasabi/core_ext/object_spec.rb
138
122
  - spec/wasabi/core_ext/string_spec.rb
139
123
  - spec/wasabi/document/authentication_spec.rb
140
124
  - spec/wasabi/document/geotrust_spec.rb
@@ -146,6 +130,7 @@ files:
146
130
  - spec/wasabi/document/soap12_spec.rb
147
131
  - spec/wasabi/document/two_bindings_spec.rb
148
132
  - spec/wasabi/document_spec.rb
133
+ - spec/wasabi/parser/import_port_types_spec.rb
149
134
  - spec/wasabi/parser/multiple_namespaces_spec.rb
150
135
  - spec/wasabi/parser/no_message_parts_spec.rb
151
136
  - spec/wasabi/parser/no_namespace_spec.rb
@@ -183,13 +168,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
168
  requirements: []
184
169
 
185
170
  rubyforge_project: wasabi
186
- rubygems_version: 1.8.21
171
+ rubygems_version: 1.8.10
187
172
  signing_key:
188
173
  specification_version: 3
189
174
  summary: A simple WSDL parser
190
175
  test_files:
191
176
  - spec/fixtures/authentication.wsdl
192
177
  - spec/fixtures/geotrust.wsdl
178
+ - spec/fixtures/import_port_types.wsdl
193
179
  - spec/fixtures/inherited.wsdl
194
180
  - spec/fixtures/lower_camel.wsdl
195
181
  - spec/fixtures/multiple_namespaces.wsdl
@@ -203,7 +189,6 @@ test_files:
203
189
  - spec/fixtures/two_bindings.wsdl
204
190
  - spec/spec_helper.rb
205
191
  - spec/support/fixture.rb
206
- - spec/wasabi/core_ext/object_spec.rb
207
192
  - spec/wasabi/core_ext/string_spec.rb
208
193
  - spec/wasabi/document/authentication_spec.rb
209
194
  - spec/wasabi/document/geotrust_spec.rb
@@ -215,6 +200,7 @@ test_files:
215
200
  - spec/wasabi/document/soap12_spec.rb
216
201
  - spec/wasabi/document/two_bindings_spec.rb
217
202
  - spec/wasabi/document_spec.rb
203
+ - spec/wasabi/parser/import_port_types_spec.rb
218
204
  - spec/wasabi/parser/multiple_namespaces_spec.rb
219
205
  - spec/wasabi/parser/no_message_parts_spec.rb
220
206
  - spec/wasabi/parser/no_namespace_spec.rb
@@ -1,14 +0,0 @@
1
- module Wasabi
2
- module CoreExt
3
- module Object
4
-
5
- # Returns +true+ if the Object is nil, false or empty. Implementation from ActiveSupport.
6
- def blank?
7
- respond_to?(:empty?) ? empty? : !self
8
- end unless method_defined?(:blank?)
9
-
10
- end
11
- end
12
- end
13
-
14
- Object.send :include, Wasabi::CoreExt::Object
@@ -1,19 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Object do
4
-
5
- describe "blank?" do
6
- it "returns true for Objects perceived to be blank" do
7
- ["", false, nil, [], {}].each do |object|
8
- object.should be_blank
9
- end
10
- end
11
-
12
- it "returns false for every other Object" do
13
- ["!blank", true, [:a], {:a => "b"}].each do |object|
14
- object.should_not be_blank
15
- end
16
- end
17
- end
18
-
19
- end