sekken 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +11 -0
- data/.yardopts +6 -0
- data/CONTRIBUTING.md +46 -0
- data/Gemfile +27 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +21 -0
- data/donate.png +0 -0
- data/lib/sekken.rb +75 -0
- data/lib/sekken/envelope.rb +92 -0
- data/lib/sekken/errors.rb +9 -0
- data/lib/sekken/example_message.rb +41 -0
- data/lib/sekken/httpclient.rb +35 -0
- data/lib/sekken/importer.rb +77 -0
- data/lib/sekken/message.rb +135 -0
- data/lib/sekken/operation.rb +100 -0
- data/lib/sekken/resolver.rb +20 -0
- data/lib/sekken/response.rb +50 -0
- data/lib/sekken/version.rb +5 -0
- data/lib/sekken/wsdl.rb +86 -0
- data/lib/sekken/wsdl/binding.rb +64 -0
- data/lib/sekken/wsdl/binding_operation.rb +85 -0
- data/lib/sekken/wsdl/document.rb +83 -0
- data/lib/sekken/wsdl/document_collection.rb +61 -0
- data/lib/sekken/wsdl/input_output.rb +84 -0
- data/lib/sekken/wsdl/message.rb +38 -0
- data/lib/sekken/wsdl/operation.rb +47 -0
- data/lib/sekken/wsdl/port.rb +29 -0
- data/lib/sekken/wsdl/port_type.rb +38 -0
- data/lib/sekken/wsdl/port_type_operation.rb +42 -0
- data/lib/sekken/wsdl/service.rb +55 -0
- data/lib/sekken/xml/attribute.rb +13 -0
- data/lib/sekken/xml/element.rb +82 -0
- data/lib/sekken/xml/element_builder.rb +220 -0
- data/lib/sekken/xs/schema.rb +57 -0
- data/lib/sekken/xs/schema_collection.rb +49 -0
- data/lib/sekken/xs/types.rb +272 -0
- data/sekken.gemspec +42 -0
- data/spec/fixtures/response/another_soap_fault.xml +14 -0
- data/spec/fixtures/response/authentication.xml +14 -0
- data/spec/fixtures/response/header.xml +13 -0
- data/spec/fixtures/response/list.xml +18 -0
- data/spec/fixtures/response/multi_ref.xml +39 -0
- data/spec/fixtures/response/soap_fault.xml +8 -0
- data/spec/fixtures/response/soap_fault12.xml +18 -0
- data/spec/fixtures/response/taxcloud.xml +1 -0
- data/spec/fixtures/wsdl/amazon.wsdl +1920 -0
- data/spec/fixtures/wsdl/arrays_with_attributes.wsdl +117 -0
- data/spec/fixtures/wsdl/authentication.wsdl +63 -0
- data/spec/fixtures/wsdl/awse.wsdl +1510 -0
- data/spec/fixtures/wsdl/betfair.wsdl +2981 -0
- data/spec/fixtures/wsdl/blz_service.wsdl +88 -0
- data/spec/fixtures/wsdl/bookt/bookt.wsdl +11 -0
- data/spec/fixtures/wsdl/bookt/bookt0.xsd +433 -0
- data/spec/fixtures/wsdl/bookt/bookt1.xsd +42 -0
- data/spec/fixtures/wsdl/bookt/bookt10.xsd +38 -0
- data/spec/fixtures/wsdl/bookt/bookt11.xsd +17 -0
- data/spec/fixtures/wsdl/bookt/bookt12.xsd +18 -0
- data/spec/fixtures/wsdl/bookt/bookt13.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt14.xsd +27 -0
- data/spec/fixtures/wsdl/bookt/bookt15.xsd +28 -0
- data/spec/fixtures/wsdl/bookt/bookt2.wsdl +243 -0
- data/spec/fixtures/wsdl/bookt/bookt2.xsd +81 -0
- data/spec/fixtures/wsdl/bookt/bookt3.wsdl +286 -0
- data/spec/fixtures/wsdl/bookt/bookt3.xsd +61 -0
- data/spec/fixtures/wsdl/bookt/bookt4.xsd +35 -0
- data/spec/fixtures/wsdl/bookt/bookt5.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt6.xsd +26 -0
- data/spec/fixtures/wsdl/bookt/bookt7.xsd +18 -0
- data/spec/fixtures/wsdl/bookt/bookt8.xsd +22 -0
- data/spec/fixtures/wsdl/bookt/bookt9.xsd +29 -0
- data/spec/fixtures/wsdl/bronto.wsdl +3285 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange.wsdl +104 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange0.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange1.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange2.wsdl +119 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange2.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange3.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange4.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange5.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange6.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange7.xsd +1 -0
- data/spec/fixtures/wsdl/bydexchange/bydexchange8.xsd +1 -0
- data/spec/fixtures/wsdl/crowd.wsdl +2437 -0
- data/spec/fixtures/wsdl/data_exchange.wsdl +98 -0
- data/spec/fixtures/wsdl/document_literal_wrapped.wsdl +153 -0
- data/spec/fixtures/wsdl/economic.wsdl +65660 -0
- data/spec/fixtures/wsdl/edialog.wsdl +13148 -0
- data/spec/fixtures/wsdl/email_verification.wsdl +394 -0
- data/spec/fixtures/wsdl/equifax.wsdl +794 -0
- data/spec/fixtures/wsdl/geotrust.wsdl +156 -0
- data/spec/fixtures/wsdl/interhome.wsdl +2137 -0
- data/spec/fixtures/wsdl/iws.wsdl +695 -0
- data/spec/fixtures/wsdl/jetairways.wsdl +156 -0
- data/spec/fixtures/wsdl/jira.wsdl +3890 -0
- data/spec/fixtures/wsdl/juniper.wsdl +215 -0
- data/spec/fixtures/wsdl/namespaced_actions.wsdl +307 -0
- data/spec/fixtures/wsdl/oracle.wsdl +3629 -0
- data/spec/fixtures/wsdl/ratp.wsdl +955 -0
- data/spec/fixtures/wsdl/rio2/rio2.wsdl +74 -0
- data/spec/fixtures/wsdl/rio2/rio2_0.wsdl +55 -0
- data/spec/fixtures/wsdl/rio2/rio2_0.xsd +58 -0
- data/spec/fixtures/wsdl/rio2/rio2_1.xsd +41 -0
- data/spec/fixtures/wsdl/rio2/rio2_2.xsd +222 -0
- data/spec/fixtures/wsdl/rio2/rio2_3.xsd +10 -0
- data/spec/fixtures/wsdl/rpc_literal.wsdl +105 -0
- data/spec/fixtures/wsdl/spyne.wsdl +70 -0
- data/spec/fixtures/wsdl/stockquote.wsdl +124 -0
- data/spec/fixtures/wsdl/taxcloud.wsdl +934 -0
- data/spec/fixtures/wsdl/team_software/team_software.wsdl +542 -0
- data/spec/fixtures/wsdl/team_software/team_software0.xsd +448 -0
- data/spec/fixtures/wsdl/team_software/team_software1.xsd +41 -0
- data/spec/fixtures/wsdl/team_software/team_software2.xsd +258 -0
- data/spec/fixtures/wsdl/team_software/team_software3.xsd +14 -0
- data/spec/fixtures/wsdl/telefonkatalogen.wsdl +45 -0
- data/spec/fixtures/wsdl/temperature.wsdl +136 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth.wsdl +157 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth1.xsd +210 -0
- data/spec/fixtures/wsdl/wasmuth/wasmuth2.xsd +549 -0
- data/spec/fixtures/wsdl/xignite.wsdl +3470 -0
- data/spec/fixtures/wsdl/yahoo.wsdl +2425 -0
- data/spec/fixtures/wsdl/zanox_export_service.xml +520 -0
- data/spec/integration/amazon_spec.rb +51 -0
- data/spec/integration/authentication_spec.rb +38 -0
- data/spec/integration/awse_spec.rb +95 -0
- data/spec/integration/betfair_spec.rb +179 -0
- data/spec/integration/blz_service_spec.rb +46 -0
- data/spec/integration/bookt_spec.rb +59 -0
- data/spec/integration/bronto_spec.rb +178 -0
- data/spec/integration/bydexchange_spec.rb +40 -0
- data/spec/integration/crowd_spec.rb +44 -0
- data/spec/integration/data_exchange_spec.rb +27 -0
- data/spec/integration/document_literal_spec.rb +104 -0
- data/spec/integration/economic_spec.rb +64 -0
- data/spec/integration/email_verification_spec.rb +82 -0
- data/spec/integration/equifax_spec.rb +216 -0
- data/spec/integration/geotrust_spec.rb +17 -0
- data/spec/integration/interhome_spec.rb +156 -0
- data/spec/integration/iws_spec.rb +27 -0
- data/spec/integration/jetairways_spec.rb +142 -0
- data/spec/integration/jira_spec.rb +27 -0
- data/spec/integration/juniper_spec.rb +20 -0
- data/spec/integration/namespaced_actions_spec.rb +37 -0
- data/spec/integration/oracle_spec.rb +61 -0
- data/spec/integration/ratp_spec.rb +178 -0
- data/spec/integration/rio2_spec.rb +56 -0
- data/spec/integration/rpc_literal_spec.rb +101 -0
- data/spec/integration/spyne_spec.rb +60 -0
- data/spec/integration/stockquote_spec.rb +46 -0
- data/spec/integration/taxcloud_spec.rb +45 -0
- data/spec/integration/team_software_spec.rb +51 -0
- data/spec/integration/telefonkatalogen_spec.rb +42 -0
- data/spec/integration/temperature_spec.rb +71 -0
- data/spec/integration/wasmuth_spec.rb +47 -0
- data/spec/integration/xignite_spec.rb +112 -0
- data/spec/integration/yahoo_spec.rb +116 -0
- data/spec/sekken/httpclient_spec.rb +41 -0
- data/spec/sekken/operation/build_spec.rb +308 -0
- data/spec/sekken/operation/document_literal_spec.rb +53 -0
- data/spec/sekken/operation/example_body_spec.rb +95 -0
- data/spec/sekken/operation/rpc_literal_spec.rb +50 -0
- data/spec/sekken/operation_spec.rb +169 -0
- data/spec/sekken/resolver_spec.rb +38 -0
- data/spec/sekken/response_spec.rb +17 -0
- data/spec/sekken/wsdl/document_spec.rb +191 -0
- data/spec/sekken/wsdl_spec.rb +46 -0
- data/spec/sekken/xs/complex_type_spec.rb +197 -0
- data/spec/sekken/xs/element_spec.rb +82 -0
- data/spec/sekken/xs/simple_type_spec.rb +39 -0
- data/spec/sekken_spec.rb +128 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/fixture.rb +19 -0
- data/spec/support/http_mock.rb +43 -0
- metadata +344 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with Rio II' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
wsdl_url = 'http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?wsdl'
|
7
|
+
wsdl0_url = 'http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?wsdl=wsdl0'
|
8
|
+
|
9
|
+
# mock wsdl imports
|
10
|
+
http_mock.fake_request(wsdl_url, 'wsdl/rio2/rio2.wsdl')
|
11
|
+
http_mock.fake_request(wsdl0_url, 'wsdl/rio2/rio2_0.wsdl')
|
12
|
+
|
13
|
+
# mock schema imports
|
14
|
+
schema_import_base = 'http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd%d'
|
15
|
+
(0..3).each do |i|
|
16
|
+
url = schema_import_base % i
|
17
|
+
http_mock.fake_request(url, "wsdl/rio2/rio2_#{i}.xsd")
|
18
|
+
end
|
19
|
+
|
20
|
+
@client = Sekken.new(wsdl_url)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'only downloads WSDL and XML Schema imports once per location' do
|
24
|
+
expect(@client.services).to eq(
|
25
|
+
'SecurityService' => {
|
26
|
+
ports: {
|
27
|
+
'BasicHttpBinding_ISecurityService' => {
|
28
|
+
type: 'http://schemas.xmlsoap.org/wsdl/soap/',
|
29
|
+
location: 'http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc/soap'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'knows the GetSessionState operation' do
|
37
|
+
service, port = :SecurityService, :BasicHttpBinding_ISecurityService
|
38
|
+
operation = @client.operation(service, port, :GetSessionState)
|
39
|
+
|
40
|
+
expect(operation.input_style).to eq('document/literal')
|
41
|
+
|
42
|
+
expect(operation.example_body).to eq(
|
43
|
+
GetSessionState: {
|
44
|
+
session: {
|
45
|
+
ApplicationId: 'string',
|
46
|
+
CultureCode: 'string',
|
47
|
+
SessionId: 'string'
|
48
|
+
},
|
49
|
+
request: {
|
50
|
+
Context: 'string'
|
51
|
+
}
|
52
|
+
}
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with an RPC/Literal example' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new fixture('wsdl/rpc_literal') }
|
6
|
+
|
7
|
+
let(:service_name) { :SampleService }
|
8
|
+
let(:port_name) { :Sample }
|
9
|
+
|
10
|
+
it 'works with op1' do
|
11
|
+
op1 = client.operation(service_name, port_name, :op1)
|
12
|
+
|
13
|
+
# Check the example request.
|
14
|
+
expect(op1.example_body).to eq(
|
15
|
+
in: {
|
16
|
+
data1: 'int',
|
17
|
+
data2: 'int'
|
18
|
+
}
|
19
|
+
)
|
20
|
+
|
21
|
+
# Build the request. It returns a Hash without the RPC wrapper element,
|
22
|
+
# because users just don't need to care about it.
|
23
|
+
op1.body = {
|
24
|
+
in: {
|
25
|
+
data1: 24,
|
26
|
+
data2: 36
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
# The expected request.
|
31
|
+
expected = Nokogiri.XML('
|
32
|
+
<env:Envelope
|
33
|
+
xmlns:lol0="http://apiNamespace.com"
|
34
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
35
|
+
<env:Header/>
|
36
|
+
<env:Body>
|
37
|
+
<lol0:op1>
|
38
|
+
<in>
|
39
|
+
<data1>24</data1>
|
40
|
+
<data2>36</data2>
|
41
|
+
</in>
|
42
|
+
</lol0:op1>
|
43
|
+
</env:Body>
|
44
|
+
</env:Envelope>
|
45
|
+
')
|
46
|
+
|
47
|
+
expect(Nokogiri.XML op1.build).
|
48
|
+
to be_equivalent_to(expected).respecting_element_order
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'works with op3' do
|
52
|
+
op3 = client.operation(service_name, port_name, :op3)
|
53
|
+
|
54
|
+
# Check the example request.
|
55
|
+
expect(op3.example_body).to eq(
|
56
|
+
DataElem: {
|
57
|
+
data1: 'int',
|
58
|
+
data2: 'int'
|
59
|
+
},
|
60
|
+
in2: {
|
61
|
+
RefDataElem: 'int'
|
62
|
+
}
|
63
|
+
)
|
64
|
+
|
65
|
+
op3.body = {
|
66
|
+
DataElem: {
|
67
|
+
data1: 64,
|
68
|
+
data2: 128
|
69
|
+
},
|
70
|
+
in2: {
|
71
|
+
RefDataElem: 3
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
# The expected request. Notice how the RPC wrapper element 'op3' is not
|
76
|
+
# namespaced because the WSDL does not define a namespace for it.
|
77
|
+
expected = Nokogiri.XML('
|
78
|
+
<env:Envelope
|
79
|
+
xmlns:lol0="http://dataNamespace.com"
|
80
|
+
xmlns:lol1="http://refNamespace.com"
|
81
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
82
|
+
<env:Header/>
|
83
|
+
<env:Body>
|
84
|
+
<op3>
|
85
|
+
<lol0:DataElem>
|
86
|
+
<data1>64</data1>
|
87
|
+
<data2>128</data2>
|
88
|
+
</lol0:DataElem>
|
89
|
+
<in2>
|
90
|
+
<lol1:RefDataElem>3</lol1:RefDataElem>
|
91
|
+
</in2>
|
92
|
+
</op3>
|
93
|
+
</env:Body>
|
94
|
+
</env:Envelope>
|
95
|
+
')
|
96
|
+
|
97
|
+
expect(Nokogiri.XML op3.build).
|
98
|
+
to be_equivalent_to(expected).respecting_element_order
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with a Spyne.io service' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new fixture('wsdl/spyne') }
|
6
|
+
|
7
|
+
let(:service_name) { :HelloWorldService }
|
8
|
+
let(:port_name) { :Application }
|
9
|
+
|
10
|
+
it 'returns a map of services and ports' do
|
11
|
+
expect(client.services).to eq(
|
12
|
+
'HelloWorldService' => {
|
13
|
+
ports: {
|
14
|
+
'Application' => {
|
15
|
+
type: 'http://schemas.xmlsoap.org/wsdl/soap/',
|
16
|
+
location: 'http://localhost:8000/'
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'knows operations with attributes and attribute groups' do
|
24
|
+
operation = client.operation(service_name, port_name, 'say_hello')
|
25
|
+
|
26
|
+
expect(operation.soap_action).to eq('say_hello')
|
27
|
+
expect(operation.endpoint).to eq('http://localhost:8000/')
|
28
|
+
|
29
|
+
expect(operation.body_parts).to eq([
|
30
|
+
[['say_hello'], { namespace: 'spyne.examples.hello', form: 'qualified', singular: true }]
|
31
|
+
])
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'creates an example body with attributes' do
|
35
|
+
operation = client.operation(service_name, port_name, :say_hello)
|
36
|
+
expect(operation.example_body).to eq(say_hello: {})
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'creates a request with attributes' do
|
40
|
+
operation = client.operation(service_name, port_name, :say_hello)
|
41
|
+
|
42
|
+
operation.body = { say_hello: {} }
|
43
|
+
|
44
|
+
expected = Nokogiri.XML('
|
45
|
+
<env:Envelope
|
46
|
+
xmlns:lol0="spyne.examples.hello"
|
47
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
48
|
+
<env:Header>
|
49
|
+
</env:Header>
|
50
|
+
<env:Body>
|
51
|
+
<lol0:say_hello/>
|
52
|
+
</env:Body>
|
53
|
+
</env:Envelope>
|
54
|
+
')
|
55
|
+
|
56
|
+
expect(Nokogiri.XML operation.build).
|
57
|
+
to be_equivalent_to(expected).respecting_element_order
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with Stockquote service' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new fixture('wsdl/stockquote') }
|
6
|
+
|
7
|
+
let(:service_name) { :StockQuote }
|
8
|
+
let(:port_name) { :StockQuoteSoap }
|
9
|
+
|
10
|
+
it 'creates an example request' do
|
11
|
+
operation = client.operation(service_name, port_name, :GetQuote)
|
12
|
+
|
13
|
+
expect(operation.example_body).to eq(
|
14
|
+
GetQuote: {
|
15
|
+
symbol: 'string'
|
16
|
+
}
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'builds a request' do
|
21
|
+
operation = client.operation(service_name, port_name, :GetQuote)
|
22
|
+
|
23
|
+
operation.body = {
|
24
|
+
GetQuote: {
|
25
|
+
symbol: 'AAPL'
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
expected = Nokogiri.XML(%{
|
30
|
+
<env:Envelope
|
31
|
+
xmlns:lol0="http://www.webserviceX.NET/"
|
32
|
+
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
|
33
|
+
<env:Header/>
|
34
|
+
<env:Body>
|
35
|
+
<lol0:GetQuote>
|
36
|
+
<lol0:symbol>AAPL</lol0:symbol>
|
37
|
+
</lol0:GetQuote>
|
38
|
+
</env:Body>
|
39
|
+
</env:Envelope>
|
40
|
+
})
|
41
|
+
|
42
|
+
expect(Nokogiri.XML operation.build).
|
43
|
+
to be_equivalent_to(expected).respecting_element_order
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with Taxcloud' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new fixture('wsdl/taxcloud') }
|
6
|
+
|
7
|
+
it 'returns a map of services and ports' do
|
8
|
+
expect(client.services).to eq(
|
9
|
+
'TaxCloud' => {
|
10
|
+
:ports => {
|
11
|
+
'TaxCloudSoap' => {
|
12
|
+
:type => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
13
|
+
:location => 'https://api.taxcloud.net/1.0/TaxCloud.asmx'
|
14
|
+
},
|
15
|
+
'TaxCloudSoap12' => {
|
16
|
+
:type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
|
17
|
+
:location => 'https://api.taxcloud.net/1.0/TaxCloud.asmx'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'knows the operations' do
|
25
|
+
service, port = 'TaxCloud', 'TaxCloudSoap'
|
26
|
+
operation = client.operation(service, port, 'VerifyAddress')
|
27
|
+
|
28
|
+
expect(operation.soap_action).to eq('http://taxcloud.net/VerifyAddress')
|
29
|
+
expect(operation.endpoint).to eq('https://api.taxcloud.net/1.0/TaxCloud.asmx')
|
30
|
+
|
31
|
+
namespace = 'http://taxcloud.net'
|
32
|
+
|
33
|
+
expect(operation.body_parts).to eq([
|
34
|
+
[['VerifyAddress'], { namespace: namespace, form: 'qualified', singular: true }],
|
35
|
+
[['VerifyAddress', 'uspsUserID'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
36
|
+
[['VerifyAddress', 'address1'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
37
|
+
[['VerifyAddress', 'address2'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
38
|
+
[['VerifyAddress', 'city'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
39
|
+
[['VerifyAddress', 'state'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
40
|
+
[['VerifyAddress', 'zip5'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }],
|
41
|
+
[['VerifyAddress', 'zip4'], { namespace: namespace, form: 'qualified', singular: true, type: 's:string' }]
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with TeamSoftware' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new(wsdl_url, http_mock) }
|
6
|
+
|
7
|
+
let(:wsdl_url) { 'http://bydexchange.nbs-us.com/BYDExchangeServer.svc?wsdl' }
|
8
|
+
|
9
|
+
before do
|
10
|
+
http_mock.fake_request(wsdl_url, 'wsdl/team_software/team_software.wsdl')
|
11
|
+
|
12
|
+
# 4 schemas to import.
|
13
|
+
#
|
14
|
+
# XXX: actually some of the imported schemas import some of the other schemas,
|
15
|
+
# but it seems like we're not following those?!
|
16
|
+
schema_import_base = 'https://winteamservicestest.myteamsoftware.com/Services.svc?xsd=xsd%d'
|
17
|
+
(0..3).each do |i|
|
18
|
+
url = schema_import_base % i
|
19
|
+
http_mock.fake_request(url, "wsdl/team_software/team_software#{i}.xsd")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns a map of services and ports' do
|
24
|
+
expect(client.services).to eq(
|
25
|
+
'ServiceManager' => {
|
26
|
+
:ports => {
|
27
|
+
'BasicHttpBinding_IWinTeamServiceManager' => {
|
28
|
+
:type => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
29
|
+
:location => 'https://winteamservicestest.myteamsoftware.com/Services.svc'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'knows the operations' do
|
37
|
+
service, port = 'ServiceManager', 'BasicHttpBinding_IWinTeamServiceManager'
|
38
|
+
operation = client.operation(service, port, 'Login')
|
39
|
+
|
40
|
+
expect(operation.soap_action).to eq('http://tempuri.org/IWinTeamServiceManager/Login')
|
41
|
+
expect(operation.endpoint).to eq('https://winteamservicestest.myteamsoftware.com/Services.svc')
|
42
|
+
|
43
|
+
namespace = 'http://tempuri.org/'
|
44
|
+
|
45
|
+
expect(operation.body_parts).to eq([
|
46
|
+
[['Login'], { namespace: namespace, form: 'qualified', singular: true }],
|
47
|
+
[['Login', 'MappingKey'], { namespace: namespace, form: 'qualified', singular: true, type: 'xs:string' }]
|
48
|
+
])
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with Telefonkatalogen' do
|
4
|
+
|
5
|
+
# reference: savon#295
|
6
|
+
subject(:client) { Sekken.new fixture('wsdl/telefonkatalogen') }
|
7
|
+
|
8
|
+
it 'returns a map of services and ports' do
|
9
|
+
expect(client.services).to eq(
|
10
|
+
'SendSms' => {
|
11
|
+
:ports => {
|
12
|
+
'SendSmsPort' => {
|
13
|
+
:type => 'http://schemas.xmlsoap.org/wsdl/soap/',
|
14
|
+
:location => 'http://bedrift.telefonkatalogen.no/tk/websvcsendsms.php'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'knows the operations' do
|
22
|
+
operation = client.operation('SendSms', 'SendSmsPort', 'sendsms')
|
23
|
+
|
24
|
+
expect(operation.soap_action).to eq('sendsms')
|
25
|
+
|
26
|
+
# notice how this contains 9 parts with one element each.
|
27
|
+
# it does not include the rpc wrapper.
|
28
|
+
|
29
|
+
expect(operation.body_parts).to eq([
|
30
|
+
[['sender'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
31
|
+
[['cellular'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
32
|
+
[['msg'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
33
|
+
[['smsnumgroup'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
34
|
+
[['emailaddr'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
35
|
+
[['udh'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
36
|
+
[['datetime'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
37
|
+
[['format'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }],
|
38
|
+
[['dlrurl'], { namespace: nil, form: 'unqualified', singular: true, type: 'xsd:string' }]
|
39
|
+
])
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Integration with Temperature service' do
|
4
|
+
|
5
|
+
subject(:client) { Sekken.new fixture('wsdl/temperature') }
|
6
|
+
|
7
|
+
let(:service_name) { :ConvertTemperature }
|
8
|
+
let(:port_name) { :ConvertTemperatureSoap12 }
|
9
|
+
|
10
|
+
it 'returns an empty Hash if there are no header parts' do
|
11
|
+
operation = client.operation(service_name, port_name, :ConvertTemp)
|
12
|
+
expect(operation.example_header).to eq({})
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'creates an example body' do
|
16
|
+
operation = client.operation(service_name, port_name, :ConvertTemp)
|
17
|
+
|
18
|
+
expect(operation.example_body).to eq(
|
19
|
+
ConvertTemp: {
|
20
|
+
Temperature: 'double',
|
21
|
+
FromUnit: 'string',
|
22
|
+
ToUnit: 'string'
|
23
|
+
}
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'builds a request' do
|
28
|
+
operation = client.operation(service_name, port_name, :ConvertTemp)
|
29
|
+
|
30
|
+
# For the corrent values to pass for :from_unit and :to_unit, I searched the WSDL for
|
31
|
+
# the 'FromUnit' type which is a 'TemperatureUnit' enumeration that looks like this:
|
32
|
+
#
|
33
|
+
# <s:simpleType name='TemperatureUnit'>
|
34
|
+
# <s:restriction base='s:string'>
|
35
|
+
# <s:enumeration value='degreeCelsius'/>
|
36
|
+
# <s:enumeration value='degreeFahrenheit'/>
|
37
|
+
# <s:enumeration value='degreeRankine'/>
|
38
|
+
# <s:enumeration value='degreeReaumur'/>
|
39
|
+
# <s:enumeration value='kelvin'/>
|
40
|
+
# </s:restriction>
|
41
|
+
# </s:simpleType>
|
42
|
+
#
|
43
|
+
# TODO: somehow expose the enumeration options through the example request.
|
44
|
+
operation.body = {
|
45
|
+
ConvertTemp: {
|
46
|
+
Temperature: 30,
|
47
|
+
FromUnit: 'degreeCelsius',
|
48
|
+
ToUnit: 'degreeFahrenheit'
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
expected = Nokogiri.XML(%{
|
53
|
+
<env:Envelope
|
54
|
+
xmlns:lol0="http://www.webserviceX.NET/"
|
55
|
+
xmlns:env="http://www.w3.org/2003/05/soap-envelope">
|
56
|
+
<env:Header/>
|
57
|
+
<env:Body>
|
58
|
+
<lol0:ConvertTemp>
|
59
|
+
<lol0:Temperature>30</lol0:Temperature>
|
60
|
+
<lol0:FromUnit>degreeCelsius</lol0:FromUnit>
|
61
|
+
<lol0:ToUnit>degreeFahrenheit</lol0:ToUnit>
|
62
|
+
</lol0:ConvertTemp>
|
63
|
+
</env:Body>
|
64
|
+
</env:Envelope>
|
65
|
+
})
|
66
|
+
|
67
|
+
expect(Nokogiri.XML operation.build).
|
68
|
+
to be_equivalent_to(expected).respecting_element_order
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|