sinatra-soap 0.1.5 → 0.1.7
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.
- checksums.yaml +8 -8
- data/README.md +70 -2
- data/lib/sinatra/soap.rb +9 -7
- data/lib/sinatra/soap/helper_methods.rb +32 -0
- data/lib/sinatra/soap/version.rb +1 -1
- data/lib/sinatra/soap/wsdl.rb +4 -3
- data/lib/sinatra/views/wsdl.builder +68 -0
- data/spec/request_spec.rb +14 -3
- data/spec/soap_spec.rb +9 -5
- data/spec/spec_helper.rb +7 -0
- data/spec/views/wsdl.builder +68 -0
- data/spec/wsdl_spec.rb +19 -1
- metadata +6 -5
- data/lib/sinatra/soap/request_context_methods.rb +0 -19
- data/spec/response_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWUwYzNjZWUyM2I2ZDZhZmFkNzM0NmVjMmQxM2QwMTJlN2E1OGIwMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGRmYTMyMmYyMTFhYjI4OTU3OWNhMTc3ZmM3MjE0YTRjNTNmNzc0Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTdmYWEyYWQyZjY1MWNlNzQxMjc4YzdmZjFiNTEwNTQ4NjlhNzk2NmExNjY4
|
10
|
+
ZWJkYjE2YzE4ZTlhMjI2YjNjMTVkYzRmMzg0YzQwNGFkYWYwMGY1NGIxZGVj
|
11
|
+
OWY3MzhhNmJkNmQ5YTQxZWQ2YzMzMTRhNjljNWQ3NGJkZDUzYzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWJiZDVjZjNjM2MwZmZhYjlmMDQ5NmMxNDE4NWY5Y2FlYzBhYmExZmM0MDZm
|
14
|
+
YTUwYmFmMDM1YWVmYzcwODBmZWM2Y2Q2ZTc4MDdhODE2ZTcwN2VkMTNkMzMy
|
15
|
+
YzAxNzM3Yjk3YjEwYWY1MzI1NzFiMDE1MmMwM2E0ZTUwYzFiMWM=
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ A classic application would work like that:
|
|
17
17
|
require 'sinatra'
|
18
18
|
require 'sinatra/soap'
|
19
19
|
|
20
|
-
soap "SomeAction"
|
20
|
+
soap "SomeAction" do
|
21
21
|
do_something_with_params # hash to be returned
|
22
22
|
end
|
23
23
|
```
|
@@ -33,14 +33,82 @@ class SoapAPI < Sinatra::Base
|
|
33
33
|
#remember to register extenstion if you are using modular style
|
34
34
|
register Sinatra::Soap
|
35
35
|
|
36
|
-
soap "SomeAction"
|
36
|
+
soap "SomeAction" do
|
37
37
|
params # hash to be returned
|
38
38
|
end
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
42
|
|
43
|
+
## Settings
|
43
44
|
|
45
|
+
* **:wsdl_route** — url for getting wsdl, either static or dynamically generated file
|
46
|
+
```ruby
|
47
|
+
set :wsdl_route, '/wsdl'
|
48
|
+
```
|
49
|
+
Defines route for app to response with wsdl. Default is '/wsdl'
|
50
|
+
|
51
|
+
|
52
|
+
* **:endpoint** — url for sending SOAP Requests
|
53
|
+
```ruby
|
54
|
+
set :endpoint, '/action'
|
55
|
+
```
|
56
|
+
Defines route for SOAP Requests. Default is '/action'
|
57
|
+
|
58
|
+
|
59
|
+
* **:wsdl_file** — app will send static file, if this setting specified
|
60
|
+
```ruby
|
61
|
+
set :wsdl_file, "wsdl.xml"
|
62
|
+
```
|
63
|
+
If wsdl_file is set, app will try to read wsdl file from ```:public_folder``` (by default ./public directory). If file does not exist, app will raise an error. You also don't need to specify ```:namespace``` or ```:service``` if you want to serve static wsdl.
|
64
|
+
|
65
|
+
|
66
|
+
* **:namespace** — wsdl setting, required for generating wsdl
|
67
|
+
```ruby
|
68
|
+
set :namespace, "http://schemas.xmlsoap.org/wsdl/"
|
69
|
+
```
|
70
|
+
Namespace is taking it's place in ```xmlns:tns``` and ```targetNamespace``` definitions of SOAP Envelope
|
71
|
+
|
72
|
+
* **:service** — wsdl setting, required for generating wsdl
|
73
|
+
```ruby
|
74
|
+
set :service, "sinatra"
|
75
|
+
```
|
76
|
+
Service involved in ```portType```, ```binding``` and ```service``` definitions as a prefix for name attribute.
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
## Soap Arguments
|
82
|
+
|
83
|
+
If you want to be able to generate wsdl on a fly, you need to specify incoming and outgoing nodes with their types.
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
soap :test, in: {circle: {center: {x: :integer,
|
87
|
+
y: :integer},
|
88
|
+
radius: :double}
|
89
|
+
},
|
90
|
+
out: nil do
|
91
|
+
params #=> {circle: {center: {x: 3, y: 2}, radius: 12.0} }
|
92
|
+
nil
|
93
|
+
end
|
94
|
+
```
|
44
95
|
|
96
|
+
The code above will respond to request like this:
|
97
|
+
```xml
|
98
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
99
|
+
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="anynamespacehere" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
100
|
+
<env:Body>
|
101
|
+
<wsdl:test>
|
102
|
+
<circle>
|
103
|
+
<center>
|
104
|
+
<x>3</x>
|
105
|
+
<y>2</y>
|
106
|
+
</center>
|
107
|
+
<radius>12.0</radius>
|
108
|
+
</circle>
|
109
|
+
</wsdl:test>
|
110
|
+
</env:Body>
|
111
|
+
</env:Envelope>
|
112
|
+
```
|
45
113
|
|
46
114
|
|
data/lib/sinatra/soap.rb
CHANGED
@@ -3,7 +3,7 @@ require "sinatra/soap/version"
|
|
3
3
|
require "sinatra/soap/wsdl"
|
4
4
|
require "sinatra/soap/error"
|
5
5
|
require "sinatra/soap/dsl_methods"
|
6
|
-
require "sinatra/soap/
|
6
|
+
require "sinatra/soap/helper_methods"
|
7
7
|
require "sinatra/soap/request"
|
8
8
|
require "sinatra/soap/response"
|
9
9
|
require "builder"
|
@@ -15,21 +15,23 @@ module Sinatra
|
|
15
15
|
include DslMethods
|
16
16
|
|
17
17
|
def self.registered(app)
|
18
|
-
app.helpers Soap::
|
18
|
+
app.helpers Soap::HelperMethods
|
19
19
|
|
20
|
-
app.set :
|
21
|
-
app.set :
|
20
|
+
app.set :wsdl_route, '/wsdl' unless defined?(app.settings.wsdl_path)
|
21
|
+
app.set :namespace, 'http://schemas.xmlsoap.org/wsdl/' unless defined?(app.settings.namespace)
|
22
|
+
app.set :endpoint, '/action' unless defined?(app.settings.endpoint)
|
23
|
+
app.set :service, 'Sinatra' unless defined?(app.settings.service)
|
22
24
|
|
23
|
-
app.post(app.settings.
|
25
|
+
app.post(app.settings.endpoint) do
|
24
26
|
content_type 'text/xml'
|
25
27
|
call_action_block
|
26
28
|
end
|
27
29
|
|
28
|
-
app.get(app.settings.
|
30
|
+
app.get(app.settings.wsdl_route) do
|
31
|
+
content_type 'text/xml'
|
29
32
|
get_wsdl
|
30
33
|
end
|
31
34
|
end
|
32
|
-
|
33
35
|
end
|
34
36
|
Delegator.delegate :soap
|
35
37
|
register Soap
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Sinatra
|
2
|
+
module Soap
|
3
|
+
module HelperMethods
|
4
|
+
|
5
|
+
# Return the location where we can find our views
|
6
|
+
def soap_views()
|
7
|
+
File.join(File.dirname(__FILE__), "..", "views")
|
8
|
+
end
|
9
|
+
|
10
|
+
def call_action_block
|
11
|
+
request = Soap::Request.new(env, request, params)
|
12
|
+
response = request.execute
|
13
|
+
builder :response, locals: {wsdl: response.wsdl, params: response.params}, :views => self.soap_views
|
14
|
+
rescue Soap::Error => e
|
15
|
+
builder :error, locals: {e: e}, :views => self.soap_views
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_wsdl
|
19
|
+
if defined?(settings.wsdl_path)
|
20
|
+
path = File.join(settings.public_folder, settings.wsdl_path)
|
21
|
+
if File.exist?(path)
|
22
|
+
File.read(path)
|
23
|
+
else
|
24
|
+
raise "No wsdl file"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
builder :wsdl, locals: {wsdl: Soap::Wsdl.actions}, :views => self.soap_views
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/sinatra/soap/version.rb
CHANGED
data/lib/sinatra/soap/wsdl.rb
CHANGED
@@ -2,11 +2,12 @@ module Sinatra
|
|
2
2
|
module Soap
|
3
3
|
class Wsdl
|
4
4
|
|
5
|
-
# class << self
|
6
|
-
# attr_accessor :actions
|
7
|
-
# end
|
8
5
|
@@actions = {}
|
9
6
|
|
7
|
+
def self.actions
|
8
|
+
@@actions
|
9
|
+
end
|
10
|
+
|
10
11
|
def self.register(name, *args, &block)
|
11
12
|
@@actions = {} if @@actions.nil?
|
12
13
|
@@actions[name] = {}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
3
|
+
'xmlns:tns' => settings.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' => settings.service,
|
9
|
+
'targetNamespace' => settings.namespace do
|
10
|
+
|
11
|
+
xml.types do
|
12
|
+
xml.tag! "schema", :targetNamespace => settings.namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do
|
13
|
+
defined = []
|
14
|
+
wsdl.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
|
+
xml.portType :name => "#{settings.service}_port" do
|
23
|
+
wsdl.keys.each do |operation|
|
24
|
+
xml.operation :name => operation do
|
25
|
+
xml.input :message => "tns:#{operation}"
|
26
|
+
xml.output :message => "tns:#{operation}Response"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
xml.binding :name => "#{settings.service}_binding", :type => "tns:#{settings.service}_port" do
|
32
|
+
xml.tag! "soap:binding", :style => 'document', :transport => 'http://schemas.xmlsoap.org/soap/http'
|
33
|
+
wsdl.keys.each do |operation|
|
34
|
+
xml.operation :name => operation do
|
35
|
+
xml.tag! "soap:operation", :soapAction => operation
|
36
|
+
xml.input do
|
37
|
+
xml.tag! "soap:body",
|
38
|
+
:use => "literal",
|
39
|
+
:namespace => settings.namespace
|
40
|
+
end
|
41
|
+
xml.output do
|
42
|
+
xml.tag! "soap:body",
|
43
|
+
:use => "literal",
|
44
|
+
:namespace => settings.namespace
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
xml.service :name => "service" do
|
51
|
+
xml.port :name => "#{settings.service}_port", :binding => "tns:#{settings.service}_binding" do
|
52
|
+
xml.tag! "soap:address", :location => send("#{settings.service}_action_url")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
wsdl.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}Response}" do
|
63
|
+
formats[:out].each do |p|
|
64
|
+
xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/request_spec.rb
CHANGED
@@ -1,16 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Request" do
|
4
|
+
def app
|
5
|
+
SoapApp
|
6
|
+
end
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
headers = {"HTTP_SOAPACTION" => 'test'}
|
10
|
+
message = '<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="any" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wsdl:test><par>one</par><par2>bar</par2><foo>wat</foo></wsdl:test></env:Body></env:Envelope>'
|
11
|
+
post '/action', message, headers
|
12
|
+
@request = Sinatra::Soap::Request.new(last_request.env, last_request, last_request.params)
|
13
|
+
end
|
14
|
+
|
4
15
|
it "should get soap_action" do
|
5
|
-
|
16
|
+
expect(@request.action).to eq(:test)
|
6
17
|
end
|
7
18
|
|
8
19
|
it "should get soap arguments" do
|
9
|
-
|
20
|
+
expect(@request.params).to eq({par: "one", par2: "bar", foo: "wat"})
|
10
21
|
end
|
11
22
|
|
12
23
|
it "should build response" do
|
13
|
-
|
24
|
+
expect(@request.execute).to be_an_instance_of(Sinatra::Soap::Response)
|
14
25
|
end
|
15
26
|
|
16
27
|
it "should validate input with WSDL" do
|
data/spec/soap_spec.rb
CHANGED
@@ -5,7 +5,6 @@ describe 'A default soap sinatra application' do
|
|
5
5
|
def app
|
6
6
|
SoapApp
|
7
7
|
end
|
8
|
-
|
9
8
|
|
10
9
|
it "should parse soap request and send response" do
|
11
10
|
headers = {"HTTP_SOAPACTION" => 'test'}
|
@@ -23,7 +22,7 @@ describe 'A default soap sinatra application' do
|
|
23
22
|
</soap:Body>
|
24
23
|
</soap:Envelope>
|
25
24
|
XML
|
26
|
-
last_response.body.
|
25
|
+
expect(last_response.body).to eq(response)
|
27
26
|
end
|
28
27
|
|
29
28
|
|
@@ -42,17 +41,22 @@ describe 'A default soap sinatra application' do
|
|
42
41
|
</soap:Body>
|
43
42
|
</soap:Envelope>
|
44
43
|
XML
|
45
|
-
last_response.body.
|
44
|
+
expect(last_response.body).to eq(response)
|
46
45
|
end
|
47
46
|
|
48
47
|
it "should have endpoint for soap actions" do
|
49
48
|
endpoint = app.routes["POST"].select {|k| k[0].to_s.match('action')}.count
|
50
|
-
endpoint.
|
49
|
+
expect(endpoint).to eq 1
|
51
50
|
end
|
52
51
|
|
53
52
|
it "should have route for wsdl" do
|
54
53
|
wsdl = app.routes["GET"].select {|k| k[0].to_s.match('wsdl')}.count
|
55
|
-
wsdl.
|
54
|
+
expect(wsdl).to eq(1)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should return a usable soap views directory" do
|
58
|
+
view_search = File.join(app.views, "*.builder")
|
59
|
+
expect(Dir.glob(view_search).count).to be > 0
|
56
60
|
end
|
57
61
|
|
58
62
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,13 @@ class SoapApp < Sinatra::Base
|
|
8
8
|
soap :test do
|
9
9
|
params
|
10
10
|
end
|
11
|
+
|
12
|
+
soap :add_circle, in: {circle: {center: {x: :integer, y: :integer},
|
13
|
+
radius: :double}},
|
14
|
+
out: nil do
|
15
|
+
params #=> {circle: {center: {x: 3, y: 2}, radius: 12.0} }
|
16
|
+
nil
|
17
|
+
end
|
11
18
|
end
|
12
19
|
|
13
20
|
module RSpecMixin
|
@@ -0,0 +1,68 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
|
3
|
+
'xmlns:tns' => settings.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' => settings.service,
|
9
|
+
'targetNamespace' => settings.namespace do
|
10
|
+
|
11
|
+
xml.types do
|
12
|
+
xml.tag! "schema", :targetNamespace => settings.namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do
|
13
|
+
defined = []
|
14
|
+
wsdl.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
|
+
xml.portType :name => "#{settings.service}_port" do
|
23
|
+
wsdl.keys.each do |operation|
|
24
|
+
xml.operation :name => operation do
|
25
|
+
xml.input :message => "tns:#{operation}"
|
26
|
+
xml.output :message => "tns:#{operation}Response"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
xml.binding :name => "#{settings.service}_binding", :type => "tns:#{settings.service}_port" do
|
32
|
+
xml.tag! "soap:binding", :style => 'document', :transport => 'http://schemas.xmlsoap.org/soap/http'
|
33
|
+
wsdl.keys.each do |operation|
|
34
|
+
xml.operation :name => operation do
|
35
|
+
xml.tag! "soap:operation", :soapAction => operation
|
36
|
+
xml.input do
|
37
|
+
xml.tag! "soap:body",
|
38
|
+
:use => "literal",
|
39
|
+
:namespace => settings.namespace
|
40
|
+
end
|
41
|
+
xml.output do
|
42
|
+
xml.tag! "soap:body",
|
43
|
+
:use => "literal",
|
44
|
+
:namespace => settings.namespace
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
xml.service :name => "service" do
|
51
|
+
xml.port :name => "#{settings.service}_port", :binding => "tns:#{settings.service}_binding" do
|
52
|
+
xml.tag! "soap:address", :location => send("#{settings.service}_action_url")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
wsdl.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}Response}" do
|
63
|
+
formats[:out].each do |p|
|
64
|
+
xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/wsdl_spec.rb
CHANGED
@@ -2,7 +2,25 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
|
4
4
|
describe "WSDL" do
|
5
|
+
|
6
|
+
def wsdl
|
7
|
+
Sinatra::Soap::Wsdl
|
8
|
+
end
|
9
|
+
|
5
10
|
it "should hold registered actions with arguments and blocks" do
|
6
|
-
|
11
|
+
[:test, :add_circle].each do |action|
|
12
|
+
expect(wsdl.actions).to include(action)
|
13
|
+
end
|
7
14
|
end
|
15
|
+
|
16
|
+
it "should hold blocks for registered actions" do
|
17
|
+
[:test, :add_circle].each do |action|
|
18
|
+
expect(wsdl.actions[action]).to include(:block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should hould arguments types" do
|
23
|
+
expect(wsdl.actions[:add_circle]).to include(:in)
|
24
|
+
expect(wsdl.actions[:add_circle]).to include(:out)
|
25
|
+
end
|
8
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-soap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Shamatov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,20 +156,21 @@ files:
|
|
156
156
|
- lib/sinatra/soap.rb
|
157
157
|
- lib/sinatra/soap/dsl_methods.rb
|
158
158
|
- lib/sinatra/soap/error.rb
|
159
|
+
- lib/sinatra/soap/helper_methods.rb
|
159
160
|
- lib/sinatra/soap/request.rb
|
160
|
-
- lib/sinatra/soap/request_context_methods.rb
|
161
161
|
- lib/sinatra/soap/response.rb
|
162
162
|
- lib/sinatra/soap/version.rb
|
163
163
|
- lib/sinatra/soap/wsdl.rb
|
164
164
|
- lib/sinatra/views/error.builder
|
165
165
|
- lib/sinatra/views/response.builder
|
166
|
+
- lib/sinatra/views/wsdl.builder
|
166
167
|
- sinatra-soap.gemspec
|
167
168
|
- spec/request_spec.rb
|
168
|
-
- spec/response_spec.rb
|
169
169
|
- spec/soap_spec.rb
|
170
170
|
- spec/spec_helper.rb
|
171
171
|
- spec/views/error.builder
|
172
172
|
- spec/views/response.builder
|
173
|
+
- spec/views/wsdl.builder
|
173
174
|
- spec/wsdl_spec.rb
|
174
175
|
homepage: https://github.com/IvanShamatov/sinatra-soap
|
175
176
|
licenses:
|
@@ -197,9 +198,9 @@ specification_version: 4
|
|
197
198
|
summary: Handling SOAP requests for sinatra inspired by washout
|
198
199
|
test_files:
|
199
200
|
- spec/request_spec.rb
|
200
|
-
- spec/response_spec.rb
|
201
201
|
- spec/soap_spec.rb
|
202
202
|
- spec/spec_helper.rb
|
203
203
|
- spec/views/error.builder
|
204
204
|
- spec/views/response.builder
|
205
|
+
- spec/views/wsdl.builder
|
205
206
|
- spec/wsdl_spec.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Sinatra
|
2
|
-
module Soap
|
3
|
-
module RequestContextMethods
|
4
|
-
|
5
|
-
def call_action_block
|
6
|
-
request = Soap::Request.new(env, request, params)
|
7
|
-
response = request.execute
|
8
|
-
builder :response, locals: {wsdl: response.wsdl, params: response.params}
|
9
|
-
rescue Soap::Error => e
|
10
|
-
builder :error, locals: {e: e}
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_wsdl
|
14
|
-
Soap::Wsdl.generate
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|