wash_out 0.9.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.travis.yml +10 -5
  4. data/Appraisals +16 -9
  5. data/Gemfile +3 -1
  6. data/README.md +112 -8
  7. data/Rakefile +15 -5
  8. data/app/helpers/wash_out_helper.rb +62 -25
  9. data/app/views/{wash_with_soap → wash_out}/document/error.builder +1 -1
  10. data/app/views/{wash_with_soap → wash_out}/document/response.builder +8 -3
  11. data/app/views/{wash_with_soap → wash_out}/document/wsdl.builder +16 -16
  12. data/app/views/{wash_with_soap → wash_out}/rpc/error.builder +1 -1
  13. data/app/views/{wash_with_soap → wash_out}/rpc/response.builder +9 -4
  14. data/app/views/{wash_with_soap → wash_out}/rpc/wsdl.builder +17 -17
  15. data/gemfiles/rails_3.2.13.gemfile +21 -0
  16. data/gemfiles/rails_4.0.0.gemfile +21 -0
  17. data/gemfiles/rails_4.1.0.gemfile +21 -0
  18. data/gemfiles/rails_4.2.0.gemfile +21 -0
  19. data/gemfiles/rails_5.0.0.beta2.gemfile +19 -0
  20. data/gemfiles/rails_5.0.0.gemfile +20 -0
  21. data/gemfiles/rails_5.1.1.gemfile +20 -0
  22. data/lib/wash_out/dispatcher.rb +126 -48
  23. data/lib/wash_out/engine.rb +1 -2
  24. data/lib/wash_out/model.rb +1 -1
  25. data/lib/wash_out/param.rb +14 -1
  26. data/lib/wash_out/router.rb +61 -19
  27. data/lib/wash_out/soap.rb +15 -3
  28. data/lib/wash_out/soap_config.rb +2 -0
  29. data/lib/wash_out/version.rb +1 -1
  30. data/lib/wash_out/wsse.rb +49 -23
  31. data/lib/wash_out.rb +35 -6
  32. data/spec/dummy/app/controllers/application_controller.rb +1 -1
  33. data/spec/dummy/config/environments/test.rb +1 -0
  34. data/spec/fixtures/nested_refs_to_arrays.xml +19 -0
  35. data/spec/fixtures/ref_to_one_array.xml +11 -0
  36. data/spec/fixtures/refs_to_arrays.xml +16 -0
  37. data/spec/lib/wash_out/dispatcher_spec.rb +135 -13
  38. data/spec/lib/wash_out/middleware_spec.rb +8 -8
  39. data/spec/lib/wash_out/param_spec.rb +43 -11
  40. data/spec/lib/wash_out/router_spec.rb +50 -0
  41. data/spec/lib/wash_out/type_spec.rb +9 -9
  42. data/spec/lib/wash_out_spec.rb +440 -88
  43. data/spec/spec_helper.rb +26 -4
  44. metadata +27 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb290b5f2914d741a1cc5ba218d0eab0b87415fc
4
- data.tar.gz: 336edc510428d18429908b002c22d8c84ab5ec41
3
+ metadata.gz: 4fceeab03335d36c3f64b930cc9380f02f8ce364
4
+ data.tar.gz: c3001962354e7327d218defdc575d4a108c2a002
5
5
  SHA512:
6
- metadata.gz: 2a06e7e53d7b0ed436951a97dbd29cb7592d1ee39743c4bb60c194e347435f6514368744540d9fafd413c906bf0337271ff897ffb7c158280c16dbe30156b32f
7
- data.tar.gz: 658031ea5d90bec54848b5ceebdf03b65ecdc3ecf46a6312f5b8adf0e523944332e81ebb5c7e4ce03c47c8cb3e948b7d550cb49170cde363ec9bab896eb3632d
6
+ metadata.gz: af7895f5b669386339ca1c26ff772764a3722e71ae9befeb759d4993be89a522c839c524682362d7c4d1250b46343cc3d5bf7847ed8c74c49d52278e909f4866
7
+ data.tar.gz: c8c62b42781fe3926f6680edddf50d87ab9f886a30f910815e32aff10527e134ea34d1e6b78535d961b49c5fa4adda4bc34cff4e4b94cf6ec9c0b15207d21d63
data/.gitignore CHANGED
@@ -2,6 +2,8 @@
2
2
  .bundle/
3
3
  *.gem
4
4
  .idea/
5
+ .ruby-gemset
6
+ .ruby-version
5
7
  .rvmrc
6
8
  *.swp
7
9
  log/*.log
@@ -9,7 +11,7 @@ pkg/
9
11
  spec/dummy/db/*.sqlite3
10
12
  spec/dummy/log/*.log
11
13
  spec/dummy/tmp/
12
- gemfiles
14
+ gemfiles/*.lock
13
15
  coverage
14
16
  tags
15
17
  Gemfile.lock
data/.travis.yml CHANGED
@@ -1,6 +1,11 @@
1
- before_install:
2
- - gem install bundler
1
+ script: bundle exec rspec
2
+ gemfile:
3
+ - gemfiles/rails_4.0.0.gemfile
4
+ - gemfiles/rails_4.1.0.gemfile
5
+ - gemfiles/rails_4.2.0.gemfile
6
+ - gemfiles/rails_5.0.0.gemfile
7
+ - gemfiles/rails_5.1.1.gemfile
3
8
  rvm:
4
- - 1.9.3
5
- - jruby-19mode
6
- - 2.0.0
9
+ - 2.3.0
10
+ before_install:
11
+ - gem update bundler
data/Appraisals CHANGED
@@ -1,15 +1,22 @@
1
- appraise "rails-3.2.8" do
2
- gem "rails", "3.2.8"
1
+ appraise "rails-4.0.0" do
2
+ gem "rails", "4.0.0"
3
+ gem "listen", "< 3.1.0"
3
4
  end
4
5
 
5
- appraise "rails-3.1.3" do
6
- gem "rails", "3.1.3"
6
+ appraise "rails-4.1.0" do
7
+ gem "rails", "4.1.0"
8
+ gem "listen", "< 3.1.0"
7
9
  end
8
10
 
9
- appraise "rails-3.2.12" do
10
- gem "rails", "3.2.12"
11
+ appraise "rails-4.2.0" do
12
+ gem "rails", "4.2.0"
13
+ gem "listen", "< 3.1.0"
11
14
  end
12
15
 
13
- appraise "rails-4.0.0" do
14
- gem "rails", "4.0.0"
15
- end
16
+ appraise "rails-5.0.0" do
17
+ gem "rails", "5.0.0"
18
+ end
19
+
20
+ appraise "rails-5.1.1" do
21
+ gem "rails", "5.1.1"
22
+ end
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
  gem 'wasabi'
6
6
  gem 'savon', '>= 2.0.0'
7
- gem 'httpi', :git => 'git://github.com/savonrb/httpi.git'
7
+ gem 'httpi'
8
8
 
9
9
  gem 'rspec-rails'
10
10
  gem 'guard'
@@ -15,3 +15,5 @@ gem 'tzinfo'
15
15
  gem 'pry'
16
16
  gem 'simplecov'
17
17
  gem 'simplecov-summary'
18
+
19
+ gem 'minitest', '<5.10.0'
data/README.md CHANGED
@@ -10,11 +10,7 @@ But if you have a chance, please [http://stopsoap.com/](http://stopsoap.com/).
10
10
 
11
11
  ## Compatibility
12
12
 
13
- Rails >3.0 only. MRI 1.9, 2.0, JRuby (--1.9).
14
-
15
- Ruby 1.8 is not officially supported since 0.5.3. We will accept further compatibilty pull-requests but no upcoming versions will be tested against it.
16
-
17
- Rubinius support temporarily dropped since 0.6.2 due to Rails 4 incompatibility.
13
+ Rails 4.0 and higher is tested. Code is known to work with earlier versions but we don't bother testing outdated versions anymore - give it a try if you are THAT unlucky.
18
14
 
19
15
  ## Installation
20
16
 
@@ -75,15 +71,97 @@ class RumbasController < ApplicationController
75
71
  :args => { :data => [:integer] },
76
72
  :return => [:boolean]
77
73
  def integers_to_boolean
78
- render :soap => params[:data].map{|x| x ? 1 : 0}
74
+ render :soap => params[:data].map{|i| i > 0}
75
+ end
76
+
77
+ # Params from XML attributes;
78
+ # e.g. for a request to the 'AddCircle' action:
79
+ # <soapenv:Envelope>
80
+ # <soapenv:Body>
81
+ # <AddCircle>
82
+ # <Circle radius="5.0">
83
+ # <Center x="10" y="12" />
84
+ # </Circle>
85
+ # </AddCircle>
86
+ # </soapenv:Body>
87
+ # </soapenv:Envelope>
88
+ soap_action "AddCircle",
89
+ :args => { :circle => { :center => { :@x => :integer,
90
+ :@y => :integer },
91
+ :@radius => :double } },
92
+ :return => nil, # [] for wash_out below 0.3.0
93
+ :to => :add_circle
94
+ def add_circle
95
+ circle = params[:circle]
96
+ Circle.new(circle[:center][:x], circle[:center][:y], circle[:radius])
97
+
98
+ render :soap => nil
79
99
  end
80
100
 
101
+ # With a customised input tag name, in case params are wrapped;
102
+ # e.g. for a request to the 'IntegersToBoolean' action:
103
+ # <soapenv:Envelope>
104
+ # <soapenv:Body>
105
+ # <MyRequest> <!-- not <IntegersToBoolean> -->
106
+ # <Data>...</Data>
107
+ # </MyRequest>
108
+ # </soapenv:Body>
109
+ # </soapenv:Envelope>
110
+ soap_action "integers_to_boolean",
111
+ :args => { :my_request => { :data => [:integer] } },
112
+ :as => 'MyRequest',
113
+ :return => [:boolean]
114
+
81
115
  # You can use all Rails features like filtering, too. A SOAP controller
82
116
  # is just like a normal controller with a special routing.
83
117
  before_filter :dump_parameters
84
118
  def dump_parameters
85
119
  Rails.logger.debug params.inspect
86
120
  end
121
+
122
+
123
+ # Rendering SOAP headers
124
+ soap_action "integer_to_header_string",
125
+ :args => :integer,
126
+ :return => :string,
127
+ :header_return => :string
128
+ def integer_to_header_string
129
+ render :soap => params[:value].to_s, :header => (params[:value]+1).to_s
130
+ end
131
+
132
+ # Reading SOAP Headers
133
+ # This is different than normal SOAP params, because we don't specify the incoming format of the header,
134
+ # but we can still access it through `soap_request.headers`. Note that the values are all strings or hashes.
135
+ soap_action "AddCircleWithHeaderRadius",
136
+ :args => { :circle => { :center => { :x => :integer,
137
+ :y => :integer } } },
138
+ :return => nil, # [] for wash_out below 0.3.0
139
+ :to => :add_circle
140
+ # e.g. for a request to the 'AddCircleWithHeaderRadius' action:
141
+ # <soapenv:Envelope>
142
+ # <soap:Header>
143
+ # <radius>12345</radius>
144
+ # </soap:Header>
145
+ # <soapenv:Body>
146
+ # <AddCircle>
147
+ # <Circle radius="5.0">
148
+ # <Center x="10" y="12" />
149
+ # </Circle>
150
+ # </AddCircle>
151
+ # </soapenv:Body>
152
+ # </soapenv:Envelope>
153
+ def add_circle_with_header_radius
154
+ circle = params[:circle]
155
+ radius = soap_request.headers[:radius]
156
+ raise SOAPError, "radius must be specified in the SOAP header" if radius.blank?
157
+ radius = radius.to_f
158
+ raise SOAPError, "radius is too small" if radius < 3.0
159
+
160
+ Circle.new(circle[:center][:x], circle[:center][:y], radius)
161
+
162
+ render :soap => nil
163
+ end
164
+
87
165
  end
88
166
  ```
89
167
 
@@ -94,7 +172,7 @@ WashOutSample::Application.routes.draw do
94
172
  end
95
173
  ```
96
174
 
97
- In such a setup, the generated WSDL may be queried at path `/api/wsdl`. So, with a
175
+ In such a setup, the generated WSDL may be queried at path `/rumbas/wsdl`. So, with a
98
176
  gem like Savon, a request can be done using this path:
99
177
 
100
178
  ```ruby
@@ -122,7 +200,7 @@ inside separate classes for the complex ones. Here's the way to do that:
122
200
  class Fluffy < WashOut::Type
123
201
  map :universe => {
124
202
  :name => :string,
125
- :age => :int
203
+ :age => :integer
126
204
  }
127
205
  end
128
206
 
@@ -137,6 +215,32 @@ To use defined type inside your inline declaration, pass the class instead of ty
137
215
  Note that WashOut extends the `ActiveRecord` so every model you use is already a WashOut::Type and can be used
138
216
  inside your interface declarations.
139
217
 
218
+ ## WSSE Authentication
219
+
220
+ WashOut provides two mechanism for WSSE Authentication.
221
+
222
+ ### Static Authentication
223
+
224
+ You can configure the service to validate against a username and password with the following configuration:
225
+
226
+ ```ruby
227
+ soap_service namespace: "wash_out", wsse_username: "username", wsse_password: "password"
228
+ ```
229
+
230
+ With this mechanism, all the actions in the controller will be authenticated against the specified username and password. If you need to authenticate different users, you can use the dynamic mechanism described below.
231
+
232
+ ### Dynamic Authentication
233
+
234
+ Dynamic authentication allows you to process the username and password any way you want, with the most common case being authenticating against a database. The configuration option for this mechanism is called `wsse_auth_callback`:
235
+
236
+ ```ruby
237
+ soap_service namespace: "wash_out", wsse_auth_callback: ->(username, password) {
238
+ return !User.find_by(username: username).authenticate(password).blank?
239
+ }
240
+ ```
241
+
242
+ Keep in mind that the password may already be hashed by the SOAP client, so you would have to check against that condition too as per [spec](http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os-UsernameTokenProfile.pdf)
243
+
140
244
  ## Configuration
141
245
 
142
246
  Use `config.wash_out...` inside your environment configuration to setup WashOut globally.
data/Rakefile CHANGED
@@ -3,12 +3,22 @@ require 'bundler/gem_tasks'
3
3
  require 'appraisal'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
6
+ RSpec::Core::RakeTask.new
7
7
 
8
- desc "Default: run the unit tests."
9
- task :default => [:all]
8
+ task :console do
9
+ require "action_controller/railtie"
10
+ require "rails/test_unit/railtie"
11
+ Bundler.require
12
+ binding.pry
13
+ end
14
+
15
+
16
+ desc 'Default: run the unit tests.'
17
+ task default: [:all]
10
18
 
11
19
  desc 'Test the plugin under all supported Rails versions.'
12
- task :all => ["appraisal:install"] do |t|
13
- exec('rake appraisal spec')
20
+ task :all do |_t|
21
+ # this is needed for minitest because it does not support "--pattern" option as Rspec Does
22
+ ENV['SPEC'] = '--name=spec/**{,/*/**}/*_spec.rb'
23
+ exec('bundle exec appraisal install && bundle exec rake appraisal spec')
14
24
  end
@@ -3,37 +3,59 @@ module WashOutHelper
3
3
  def wsdl_data_options(param)
4
4
  case controller.soap_config.wsdl_style
5
5
  when 'rpc'
6
- { :"xsi:type" => param.namespaced_type }
6
+ if param.map.present? || !param.value.nil?
7
+ { :"xsi:type" => param.namespaced_type }
8
+ else
9
+ { :"xsi:nil" => true }
10
+ end
7
11
  when 'document'
8
- { }
12
+ {}
13
+ else
14
+ {}
15
+ end
16
+ end
17
+
18
+ def wsdl_data_attrs(param)
19
+ param.map.reduce({}) do |memo, p|
20
+ if p.respond_to?(:attribute?) && p.attribute?
21
+ memo.merge p.attr_name => p.value
22
+ else
23
+ memo
24
+ end
9
25
  end
10
26
  end
11
27
 
12
28
  def wsdl_data(xml, params)
13
29
  params.each do |param|
30
+ next if param.attribute?
31
+
14
32
  tag_name = param.name
15
33
  param_options = wsdl_data_options(param)
34
+ param_options.merge! wsdl_data_attrs(param)
16
35
 
17
- if !param.struct?
18
- if !param.multiplied
19
- xml.tag! tag_name, param.value, param_options
36
+ if param.struct?
37
+ if param.multiplied
38
+ param.map.each do |p|
39
+ attrs = wsdl_data_attrs p
40
+ if p.is_a?(Array) || p.map.size > attrs.size
41
+ blk = proc { wsdl_data(xml, p.map) }
42
+ end
43
+ attrs.reject! { |_, v| v.nil? }
44
+ xml.tag! tag_name, param_options.merge(attrs), &blk
45
+ end
20
46
  else
21
- param.value = [] unless param.value.is_a?(Array)
22
- param.value.each do |v|
23
- xml.tag! tag_name, v, param_options
47
+ xml.tag! tag_name, param_options do
48
+ wsdl_data(xml, param.map)
24
49
  end
25
50
  end
26
51
  else
27
- if !param.multiplied
28
- xml.tag! tag_name, param_options do
29
- wsdl_data(xml, param.map)
52
+ if param.multiplied
53
+ param.value = [] unless param.value.is_a?(Array)
54
+ param.value.each do |v|
55
+ xml.tag! tag_name, v, param_options
30
56
  end
31
57
  else
32
- param.map.each do |p|
33
- xml.tag! tag_name, param_options do
34
- wsdl_data(xml, p.map)
35
- end
36
- end
58
+ xml.tag! tag_name, param.value, param_options
37
59
  end
38
60
  end
39
61
  end
@@ -45,12 +67,27 @@ module WashOutHelper
45
67
  if param.struct?
46
68
  if !defined.include?(param.basic_type)
47
69
  xml.tag! "xsd:complexType", :name => param.basic_type do
48
- xml.tag! "xsd:sequence" do
49
- param.map.each do |value|
50
- more << value if value.struct?
51
- xml.tag! "xsd:element", wsdl_occurence(value, false, :name => value.name, :type => value.namespaced_type)
70
+ attrs, elems = [], []
71
+ param.map.each do |value|
72
+ more << value if value.struct?
73
+ if value.attribute?
74
+ attrs << value
75
+ else
76
+ elems << value
52
77
  end
53
78
  end
79
+
80
+ if elems.any?
81
+ xml.tag! "xsd:sequence" do
82
+ elems.each do |value|
83
+ xml.tag! "xsd:element", wsdl_occurence(value, false, :name => value.name, :type => value.namespaced_type)
84
+ end
85
+ end
86
+ end
87
+
88
+ attrs.each do |value|
89
+ xml.tag! "xsd:attribute", wsdl_occurence(value, false, :name => value.attr_name, :type => value.namespaced_type)
90
+ end
54
91
  end
55
92
 
56
93
  defined << param.basic_type
@@ -65,11 +102,11 @@ module WashOutHelper
65
102
  end
66
103
 
67
104
  def wsdl_occurence(param, inject, extend_with = {})
68
- data = !param.multiplied ? {} : {
69
- "#{'xsi:' if inject}minOccurs" => 0,
70
- "#{'xsi:' if inject}maxOccurs" => 'unbounded'
71
- }
72
-
105
+ data = {"#{'xsi:' if inject}nillable" => 'true'}
106
+ if param.multiplied
107
+ data["#{'xsi:' if inject}minOccurs"] = 0
108
+ data["#{'xsi:' if inject}maxOccurs"] = 'unbounded'
109
+ end
73
110
  extend_with.merge(data)
74
111
  end
75
112
  end
@@ -2,7 +2,7 @@ xml.instruct!
2
2
  xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/' do
3
3
  xml.tag! "soap:Body" do
4
4
  xml.tag! "soap:Fault" do
5
- xml.faultcode "soap:Server"
5
+ xml.faultcode error_code
6
6
  xml.faultstring error_message
7
7
  end
8
8
  end
@@ -2,10 +2,15 @@ xml.instruct!
2
2
  xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/',
3
3
  "xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema',
4
4
  "xmlns:tns" => @namespace do
5
+ if !header.nil?
6
+ xml.tag! "soap:Header" do
7
+ xml.tag! "tns:#{@action_spec[:response_tag]}" do
8
+ wsdl_data xml, header
9
+ end
10
+ end
11
+ end
5
12
  xml.tag! "soap:Body" do
6
- key = "tns:#{@operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}"
7
-
8
- xml.tag! @action_spec[:response_tag] do
13
+ xml.tag! "tns:#{@action_spec[:response_tag]}" do
9
14
  wsdl_data xml, result
10
15
  end
11
16
  end
@@ -19,11 +19,24 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
19
19
  end
20
20
  end
21
21
 
22
+ @map.each do |operation, formats|
23
+ xml.message :name => "#{operation}" do
24
+ formats[:in].each do |p|
25
+ xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
26
+ end
27
+ end
28
+ xml.message :name => formats[:response_tag] do
29
+ formats[:out].each do |p|
30
+ xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
31
+ end
32
+ end
33
+ end
34
+
22
35
  xml.portType :name => "#{@name}_port" do
23
- @map.keys.each do |operation|
36
+ @map.each do |operation, formats|
24
37
  xml.operation :name => operation do
25
38
  xml.input :message => "tns:#{operation}"
26
- xml.output :message => "tns:#{operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}"
39
+ xml.output :message => "tns:#{formats[:response_tag]}"
27
40
  end
28
41
  end
29
42
  end
@@ -49,20 +62,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
49
62
 
50
63
  xml.service :name => "service" do
51
64
  xml.port :name => "#{@name}_port", :binding => "tns:#{@name}_binding" do
52
- xml.tag! "soap:address", :location => send("#{@name}_action_url")
53
- end
54
- end
55
-
56
- @map.each do |operation, formats|
57
- xml.message :name => "#{operation}" do
58
- formats[:in].each do |p|
59
- xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
60
- end
61
- end
62
- xml.message :name => "#{operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}" do
63
- formats[:out].each do |p|
64
- xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
65
- end
65
+ xml.tag! "soap:address", :location => WashOut::Router.url(request, @name)
66
66
  end
67
67
  end
68
68
  end
@@ -3,7 +3,7 @@ xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envel
3
3
  "xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance' do
4
4
  xml.tag! "soap:Body" do
5
5
  xml.tag! "soap:Fault", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do
6
- xml.faultcode "Server", 'xsi:type' => 'xsd:QName'
6
+ xml.faultcode error_code, 'xsi:type' => 'xsd:QName'
7
7
  xml.faultstring error_message, 'xsi:type' => 'xsd:string'
8
8
  end
9
9
  end
@@ -3,11 +3,16 @@ xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envel
3
3
  "xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema',
4
4
  "xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
5
5
  "xmlns:tns" => @namespace do
6
+ if !header.nil?
7
+ xml.tag! "soap:Header" do
8
+ xml.tag! "tns:#{@action_spec[:response_tag]}" do
9
+ wsdl_data xml, header
10
+ end
11
+ end
12
+ end
6
13
  xml.tag! "soap:Body" do
7
- key = "tns:#{@operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}"
8
-
9
- xml.tag! @action_spec[:response_tag] do
14
+ xml.tag! "tns:#{@action_spec[:response_tag]}" do
10
15
  wsdl_data xml, result
11
16
  end
12
17
  end
13
- end
18
+ end
@@ -19,11 +19,24 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
19
19
  end
20
20
  end
21
21
 
22
+ @map.each do |operation, formats|
23
+ xml.message :name => "#{operation}" do
24
+ formats[:in].each do |p|
25
+ xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
26
+ end
27
+ end
28
+ xml.message :name => formats[:response_tag] do
29
+ formats[:out].each do |p|
30
+ xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
31
+ end
32
+ end
33
+ end
34
+
22
35
  xml.portType :name => "#{@name}_port" do
23
- @map.keys.each do |operation|
36
+ @map.each do |operation, formats|
24
37
  xml.operation :name => operation do
25
38
  xml.input :message => "tns:#{operation}"
26
- xml.output :message => "tns:#{operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}"
39
+ xml.output :message => "tns:#{formats[:response_tag]}"
27
40
  end
28
41
  end
29
42
  end
@@ -49,20 +62,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
49
62
 
50
63
  xml.service :name => "service" do
51
64
  xml.port :name => "#{@name}_port", :binding => "tns:#{@name}_binding" do
52
- xml.tag! "soap:address", :location => send("#{@name}_action_url")
53
- end
54
- end
55
-
56
- @map.each do |operation, formats|
57
- xml.message :name => "#{operation}" do
58
- formats[:in].each do |p|
59
- xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
60
- end
61
- end
62
- xml.message :name => "#{operation}#{controller.soap_config.camelize_wsdl ? 'Response' : '_response'}" do
63
- formats[:out].each do |p|
64
- xml.part wsdl_occurence(p, true, :name => p.name, :type => p.namespaced_type)
65
- end
65
+ xml.tag! "soap:address", :location => WashOut::Router.url(request, @name)
66
66
  end
67
67
  end
68
- end
68
+ end
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wasabi"
6
+ gem "savon", ">= 2.0.0"
7
+ gem "httpi"
8
+ gem "rspec-rails"
9
+ gem "guard"
10
+ gem "guard-rspec"
11
+ gem "rb-fsevent"
12
+ gem "appraisal"
13
+ gem "tzinfo"
14
+ gem "pry"
15
+ gem "simplecov"
16
+ gem "simplecov-summary"
17
+ gem "rails", "3.2.13"
18
+ gem "test-unit"
19
+ gem "listen", "< 3.1.0"
20
+
21
+ gemspec :path => "../"
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wasabi"
6
+ gem "savon", ">= 2.0.0"
7
+ gem "httpi"
8
+ gem "rspec-rails"
9
+ gem "guard"
10
+ gem "guard-rspec"
11
+ gem "rb-fsevent"
12
+ gem "appraisal"
13
+ gem "tzinfo"
14
+ gem "pry"
15
+ gem "simplecov"
16
+ gem "simplecov-summary"
17
+ gem "minitest", "<5.10.0"
18
+ gem "rails", "4.0.0"
19
+ gem "listen", "< 3.1.0"
20
+
21
+ gemspec path: "../"
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wasabi"
6
+ gem "savon", ">= 2.0.0"
7
+ gem "httpi"
8
+ gem "rspec-rails"
9
+ gem "guard"
10
+ gem "guard-rspec"
11
+ gem "rb-fsevent"
12
+ gem "appraisal"
13
+ gem "tzinfo"
14
+ gem "pry"
15
+ gem "simplecov"
16
+ gem "simplecov-summary"
17
+ gem "minitest", "<5.10.0"
18
+ gem "rails", "4.1.0"
19
+ gem "listen", "< 3.1.0"
20
+
21
+ gemspec path: "../"
@@ -0,0 +1,21 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "wasabi"
6
+ gem "savon", ">= 2.0.0"
7
+ gem "httpi"
8
+ gem "rspec-rails"
9
+ gem "guard"
10
+ gem "guard-rspec"
11
+ gem "rb-fsevent"
12
+ gem "appraisal"
13
+ gem "tzinfo"
14
+ gem "pry"
15
+ gem "simplecov"
16
+ gem "simplecov-summary"
17
+ gem "minitest", "<5.10.0"
18
+ gem "rails", "4.2.0"
19
+ gem "listen", "< 3.1.0"
20
+
21
+ gemspec path: "../"