wash_out_fork 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.travis.yml +36 -0
- data/Appraisals +25 -0
- data/CHANGELOG.md +102 -0
- data/Gemfile +17 -0
- data/Guardfile +12 -0
- data/LICENSE +22 -0
- data/README.md +242 -0
- data/Rakefile +25 -0
- data/app/helpers/wash_out_fork_helper.rb +110 -0
- data/app/views/wash_out_fork/document/error.builder +9 -0
- data/app/views/wash_out_fork/document/response.builder +8 -0
- data/app/views/wash_out_fork/document/wsdl.builder +68 -0
- data/app/views/wash_out_fork/rpc/error.builder +10 -0
- data/app/views/wash_out_fork/rpc/response.builder +9 -0
- data/app/views/wash_out_fork/rpc/wsdl.builder +68 -0
- data/gemfiles/rails_3.2.13.gemfile +21 -0
- data/gemfiles/rails_4.0.0.gemfile +20 -0
- data/gemfiles/rails_4.1.0.gemfile +20 -0
- data/gemfiles/rails_4.2.0.gemfile +20 -0
- data/gemfiles/rails_5.0.0.beta2.gemfile +19 -0
- data/gemfiles/rails_5.0.0.gemfile +19 -0
- data/init.rb +1 -0
- data/lib/wash_out_fork.rb +60 -0
- data/lib/wash_out_fork/configurable.rb +41 -0
- data/lib/wash_out_fork/dispatcher.rb +232 -0
- data/lib/wash_out_fork/engine.rb +12 -0
- data/lib/wash_out_fork/middleware.rb +41 -0
- data/lib/wash_out_fork/model.rb +29 -0
- data/lib/wash_out_fork/param.rb +200 -0
- data/lib/wash_out_fork/router.rb +131 -0
- data/lib/wash_out_fork/soap.rb +48 -0
- data/lib/wash_out_fork/soap_config.rb +93 -0
- data/lib/wash_out_fork/type.rb +29 -0
- data/lib/wash_out_fork/version.rb +3 -0
- data/lib/wash_out_fork/wsse.rb +101 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +23 -0
- data/spec/dummy/config/environments/test.rb +30 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +8 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/fixtures/nested_refs_to_arrays.xml +19 -0
- data/spec/fixtures/ref_to_one_array.xml +11 -0
- data/spec/fixtures/refs_to_arrays.xml +16 -0
- data/spec/lib/wash_out/dispatcher_spec.rb +206 -0
- data/spec/lib/wash_out/middleware_spec.rb +33 -0
- data/spec/lib/wash_out/param_spec.rb +94 -0
- data/spec/lib/wash_out/router_spec.rb +50 -0
- data/spec/lib/wash_out/type_spec.rb +41 -0
- data/spec/lib/wash_out_spec.rb +797 -0
- data/spec/spec_helper.rb +88 -0
- data/wash_out_fork.gemspec +20 -0
- metadata +130 -0
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'appraisal'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :console do
|
10
|
+
require "action_controller/railtie"
|
11
|
+
require "rails/test_unit/railtie"
|
12
|
+
Bundler.require
|
13
|
+
binding.pry
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
desc 'Default: run the unit tests.'
|
18
|
+
task default: [:all]
|
19
|
+
|
20
|
+
desc 'Test the plugin under all supported Rails versions.'
|
21
|
+
task :all do |_t|
|
22
|
+
# this is needed for minitest because it does not support "--pattern" option as Rspec Does
|
23
|
+
ENV['SPEC'] = '--name=spec/**{,/*/**}/*_spec.rb'
|
24
|
+
exec('bundle exec appraisal install && bundle exec rake appraisal spec')
|
25
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module WashOutForkHelper
|
2
|
+
|
3
|
+
def wsdl_data_options(param)
|
4
|
+
case controller.soap_config.wsdl_style
|
5
|
+
when 'rpc'
|
6
|
+
if param.map.present? || param.value
|
7
|
+
{ :"xsi:type" => param.namespaced_type }
|
8
|
+
else
|
9
|
+
{ :"xsi:nil" => true }
|
10
|
+
end
|
11
|
+
when 'document'
|
12
|
+
{ }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def wsdl_data_attrs(param)
|
17
|
+
param.map.reduce({}) do |memo, p|
|
18
|
+
if p.respond_to?(:attribute?) && p.attribute?
|
19
|
+
memo.merge p.attr_name => p.value
|
20
|
+
else
|
21
|
+
memo
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def wsdl_data(xml, params)
|
27
|
+
params.each do |param|
|
28
|
+
next if param.attribute?
|
29
|
+
|
30
|
+
tag_name = param.name
|
31
|
+
param_options = wsdl_data_options(param)
|
32
|
+
param_options.merge! wsdl_data_attrs(param)
|
33
|
+
|
34
|
+
if param.struct?
|
35
|
+
if param.multiplied
|
36
|
+
param.map.each do |p|
|
37
|
+
attrs = wsdl_data_attrs p
|
38
|
+
if p.is_a?(Array) || p.map.size > attrs.size
|
39
|
+
blk = proc { wsdl_data(xml, p.map) }
|
40
|
+
end
|
41
|
+
attrs.reject! { |_, v| v.nil? }
|
42
|
+
xml.tag! tag_name, param_options.merge(attrs), &blk
|
43
|
+
end
|
44
|
+
else
|
45
|
+
xml.tag! tag_name, param_options do
|
46
|
+
wsdl_data(xml, param.map)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
else
|
50
|
+
if param.multiplied
|
51
|
+
param.value = [] unless param.value.is_a?(Array)
|
52
|
+
param.value.each do |v|
|
53
|
+
xml.tag! tag_name, v, param_options
|
54
|
+
end
|
55
|
+
else
|
56
|
+
xml.tag! tag_name, param.value, param_options
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def wsdl_type(xml, param, defined=[])
|
63
|
+
more = []
|
64
|
+
|
65
|
+
if param.struct?
|
66
|
+
if !defined.include?(param.basic_type)
|
67
|
+
xml.tag! "xsd:complexType", :name => param.basic_type do
|
68
|
+
attrs, elems = [], []
|
69
|
+
param.map.each do |value|
|
70
|
+
more << value if value.struct?
|
71
|
+
if value.attribute?
|
72
|
+
attrs << value
|
73
|
+
else
|
74
|
+
elems << value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if elems.any?
|
79
|
+
xml.tag! "xsd:sequence" do
|
80
|
+
elems.each do |value|
|
81
|
+
xml.tag! "xsd:element", wsdl_occurence(value, false, :name => value.name, :type => value.namespaced_type)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
attrs.each do |value|
|
87
|
+
xml.tag! "xsd:attribute", wsdl_occurence(value, false, :name => value.attr_name, :type => value.namespaced_type)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
defined << param.basic_type
|
92
|
+
elsif !param.classified?
|
93
|
+
raise RuntimeError, "Duplicate use of `#{param.basic_type}` type name. Consider using classified types."
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
more.each do |p|
|
98
|
+
wsdl_type xml, p, defined
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def wsdl_occurence(param, inject, extend_with = {})
|
103
|
+
data = {"#{'xsi:' if inject}nillable" => 'true'}
|
104
|
+
if param.multiplied
|
105
|
+
data["#{'xsi:' if inject}minOccurs"] = 0
|
106
|
+
data["#{'xsi:' if inject}maxOccurs"] = 'unbounded'
|
107
|
+
end
|
108
|
+
extend_with.merge(data)
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
3
|
+
'xmlns:tns' => @namespace,
|
4
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
5
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
6
|
+
'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
7
|
+
'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
|
8
|
+
'name' => @name,
|
9
|
+
'targetNamespace' => @namespace do
|
10
|
+
|
11
|
+
xml.types do
|
12
|
+
xml.tag! "schema", :targetNamespace => @namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do
|
13
|
+
defined = []
|
14
|
+
@map.each do |operation, formats|
|
15
|
+
(formats[:in] + formats[:out]).each do |p|
|
16
|
+
wsdl_type xml, p, defined
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
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
|
+
|
35
|
+
xml.portType :name => "#{@name}_port" do
|
36
|
+
@map.each do |operation, formats|
|
37
|
+
xml.operation :name => operation do
|
38
|
+
xml.input :message => "tns:#{operation}"
|
39
|
+
xml.output :message => "tns:#{formats[:response_tag]}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
xml.binding :name => "#{@name}_binding", :type => "tns:#{@name}_port" do
|
45
|
+
xml.tag! "soap:binding", :style => 'document', :transport => 'http://schemas.xmlsoap.org/soap/http'
|
46
|
+
@map.keys.each do |operation|
|
47
|
+
xml.operation :name => operation do
|
48
|
+
xml.tag! "soap:operation", :soapAction => operation
|
49
|
+
xml.input do
|
50
|
+
xml.tag! "soap:body",
|
51
|
+
:use => "literal",
|
52
|
+
:namespace => @namespace
|
53
|
+
end
|
54
|
+
xml.output do
|
55
|
+
xml.tag! "soap:body",
|
56
|
+
:use => "literal",
|
57
|
+
:namespace => @namespace
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
xml.service :name => "service" do
|
64
|
+
xml.port :name => "#{@name}_port", :binding => "tns:#{@name}_binding" do
|
65
|
+
xml.tag! "soap:address", :location => WashOutFork::Router.url(request, @name)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/',
|
3
|
+
"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance' do
|
4
|
+
xml.tag! "soap:Body" do
|
5
|
+
xml.tag! "soap:Fault", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do
|
6
|
+
xml.faultcode error_code, 'xsi:type' => 'xsd:QName'
|
7
|
+
xml.faultstring error_message, 'xsi:type' => 'xsd:string'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/',
|
3
|
+
"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema',
|
4
|
+
"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
|
5
|
+
"xmlns:tns" => @namespace do
|
6
|
+
xml.tag! "soap:Body" do
|
7
|
+
wsdl_data xml, result
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
3
|
+
'xmlns:tns' => @namespace,
|
4
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
5
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
6
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
7
|
+
'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
8
|
+
'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
|
9
|
+
'name' => @name,
|
10
|
+
'targetNamespace' => @namespace do
|
11
|
+
xml.types do
|
12
|
+
xml.tag! "schema", :targetNamespace => @namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do
|
13
|
+
defined = []
|
14
|
+
@map.each do |operation, formats|
|
15
|
+
(formats[:in] + formats[:out]).each do |p|
|
16
|
+
wsdl_type xml, p, defined
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
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
|
+
|
35
|
+
xml.portType :name => "#{@name}_port" do
|
36
|
+
@map.each do |operation, formats|
|
37
|
+
xml.operation :name => operation do
|
38
|
+
xml.input :message => "tns:#{operation}"
|
39
|
+
xml.output :message => "tns:#{formats[:response_tag]}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
xml.binding :name => "#{@name}_binding", :type => "tns:#{@name}_port" do
|
45
|
+
xml.tag! "soap:binding", :style => 'rpc', :transport => 'http://schemas.xmlsoap.org/soap/http'
|
46
|
+
@map.keys.each do |operation|
|
47
|
+
xml.operation :name => operation do
|
48
|
+
xml.tag! "soap:operation", :soapAction => operation
|
49
|
+
xml.input do
|
50
|
+
xml.tag! "soap:body",
|
51
|
+
:use => "encoded", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/',
|
52
|
+
:namespace => @namespace
|
53
|
+
end
|
54
|
+
xml.output do
|
55
|
+
xml.tag! "soap:body",
|
56
|
+
:use => "encoded", :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/',
|
57
|
+
:namespace => @namespace
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
xml.service :name => "service" do
|
64
|
+
xml.port :name => "#{@name}_port", :binding => "tns:#{@name}_binding" do
|
65
|
+
xml.tag! "soap:address", :location => WashOutFork::Router.url(request, @name)
|
66
|
+
end
|
67
|
+
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,20 @@
|
|
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", "4.0.0"
|
18
|
+
gem "listen", "< 3.1.0"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|
@@ -0,0 +1,20 @@
|
|
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", "4.1.0"
|
18
|
+
gem "listen", "< 3.1.0"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|
@@ -0,0 +1,20 @@
|
|
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", "4.2.0"
|
18
|
+
gem "listen", "< 3.1.0"
|
19
|
+
|
20
|
+
gemspec :path => "../"
|
@@ -0,0 +1,19 @@
|
|
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", "5.0.0.beta2"
|
18
|
+
|
19
|
+
gemspec :path => "../"
|
@@ -0,0 +1,19 @@
|
|
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", "5.0.0"
|
18
|
+
|
19
|
+
gemspec :path => "../"
|