sekken 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +11 -0
  4. data/.yardopts +6 -0
  5. data/CONTRIBUTING.md +46 -0
  6. data/Gemfile +27 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +28 -0
  9. data/Rakefile +21 -0
  10. data/donate.png +0 -0
  11. data/lib/sekken.rb +75 -0
  12. data/lib/sekken/envelope.rb +92 -0
  13. data/lib/sekken/errors.rb +9 -0
  14. data/lib/sekken/example_message.rb +41 -0
  15. data/lib/sekken/httpclient.rb +35 -0
  16. data/lib/sekken/importer.rb +77 -0
  17. data/lib/sekken/message.rb +135 -0
  18. data/lib/sekken/operation.rb +100 -0
  19. data/lib/sekken/resolver.rb +20 -0
  20. data/lib/sekken/response.rb +50 -0
  21. data/lib/sekken/version.rb +5 -0
  22. data/lib/sekken/wsdl.rb +86 -0
  23. data/lib/sekken/wsdl/binding.rb +64 -0
  24. data/lib/sekken/wsdl/binding_operation.rb +85 -0
  25. data/lib/sekken/wsdl/document.rb +83 -0
  26. data/lib/sekken/wsdl/document_collection.rb +61 -0
  27. data/lib/sekken/wsdl/input_output.rb +84 -0
  28. data/lib/sekken/wsdl/message.rb +38 -0
  29. data/lib/sekken/wsdl/operation.rb +47 -0
  30. data/lib/sekken/wsdl/port.rb +29 -0
  31. data/lib/sekken/wsdl/port_type.rb +38 -0
  32. data/lib/sekken/wsdl/port_type_operation.rb +42 -0
  33. data/lib/sekken/wsdl/service.rb +55 -0
  34. data/lib/sekken/xml/attribute.rb +13 -0
  35. data/lib/sekken/xml/element.rb +82 -0
  36. data/lib/sekken/xml/element_builder.rb +220 -0
  37. data/lib/sekken/xs/schema.rb +57 -0
  38. data/lib/sekken/xs/schema_collection.rb +49 -0
  39. data/lib/sekken/xs/types.rb +272 -0
  40. data/sekken.gemspec +42 -0
  41. data/spec/fixtures/response/another_soap_fault.xml +14 -0
  42. data/spec/fixtures/response/authentication.xml +14 -0
  43. data/spec/fixtures/response/header.xml +13 -0
  44. data/spec/fixtures/response/list.xml +18 -0
  45. data/spec/fixtures/response/multi_ref.xml +39 -0
  46. data/spec/fixtures/response/soap_fault.xml +8 -0
  47. data/spec/fixtures/response/soap_fault12.xml +18 -0
  48. data/spec/fixtures/response/taxcloud.xml +1 -0
  49. data/spec/fixtures/wsdl/amazon.wsdl +1920 -0
  50. data/spec/fixtures/wsdl/arrays_with_attributes.wsdl +117 -0
  51. data/spec/fixtures/wsdl/authentication.wsdl +63 -0
  52. data/spec/fixtures/wsdl/awse.wsdl +1510 -0
  53. data/spec/fixtures/wsdl/betfair.wsdl +2981 -0
  54. data/spec/fixtures/wsdl/blz_service.wsdl +88 -0
  55. data/spec/fixtures/wsdl/bookt/bookt.wsdl +11 -0
  56. data/spec/fixtures/wsdl/bookt/bookt0.xsd +433 -0
  57. data/spec/fixtures/wsdl/bookt/bookt1.xsd +42 -0
  58. data/spec/fixtures/wsdl/bookt/bookt10.xsd +38 -0
  59. data/spec/fixtures/wsdl/bookt/bookt11.xsd +17 -0
  60. data/spec/fixtures/wsdl/bookt/bookt12.xsd +18 -0
  61. data/spec/fixtures/wsdl/bookt/bookt13.xsd +22 -0
  62. data/spec/fixtures/wsdl/bookt/bookt14.xsd +27 -0
  63. data/spec/fixtures/wsdl/bookt/bookt15.xsd +28 -0
  64. data/spec/fixtures/wsdl/bookt/bookt2.wsdl +243 -0
  65. data/spec/fixtures/wsdl/bookt/bookt2.xsd +81 -0
  66. data/spec/fixtures/wsdl/bookt/bookt3.wsdl +286 -0
  67. data/spec/fixtures/wsdl/bookt/bookt3.xsd +61 -0
  68. data/spec/fixtures/wsdl/bookt/bookt4.xsd +35 -0
  69. data/spec/fixtures/wsdl/bookt/bookt5.xsd +22 -0
  70. data/spec/fixtures/wsdl/bookt/bookt6.xsd +26 -0
  71. data/spec/fixtures/wsdl/bookt/bookt7.xsd +18 -0
  72. data/spec/fixtures/wsdl/bookt/bookt8.xsd +22 -0
  73. data/spec/fixtures/wsdl/bookt/bookt9.xsd +29 -0
  74. data/spec/fixtures/wsdl/bronto.wsdl +3285 -0
  75. data/spec/fixtures/wsdl/bydexchange/bydexchange.wsdl +104 -0
  76. data/spec/fixtures/wsdl/bydexchange/bydexchange0.xsd +1 -0
  77. data/spec/fixtures/wsdl/bydexchange/bydexchange1.xsd +1 -0
  78. data/spec/fixtures/wsdl/bydexchange/bydexchange2.wsdl +119 -0
  79. data/spec/fixtures/wsdl/bydexchange/bydexchange2.xsd +1 -0
  80. data/spec/fixtures/wsdl/bydexchange/bydexchange3.xsd +1 -0
  81. data/spec/fixtures/wsdl/bydexchange/bydexchange4.xsd +1 -0
  82. data/spec/fixtures/wsdl/bydexchange/bydexchange5.xsd +1 -0
  83. data/spec/fixtures/wsdl/bydexchange/bydexchange6.xsd +1 -0
  84. data/spec/fixtures/wsdl/bydexchange/bydexchange7.xsd +1 -0
  85. data/spec/fixtures/wsdl/bydexchange/bydexchange8.xsd +1 -0
  86. data/spec/fixtures/wsdl/crowd.wsdl +2437 -0
  87. data/spec/fixtures/wsdl/data_exchange.wsdl +98 -0
  88. data/spec/fixtures/wsdl/document_literal_wrapped.wsdl +153 -0
  89. data/spec/fixtures/wsdl/economic.wsdl +65660 -0
  90. data/spec/fixtures/wsdl/edialog.wsdl +13148 -0
  91. data/spec/fixtures/wsdl/email_verification.wsdl +394 -0
  92. data/spec/fixtures/wsdl/equifax.wsdl +794 -0
  93. data/spec/fixtures/wsdl/geotrust.wsdl +156 -0
  94. data/spec/fixtures/wsdl/interhome.wsdl +2137 -0
  95. data/spec/fixtures/wsdl/iws.wsdl +695 -0
  96. data/spec/fixtures/wsdl/jetairways.wsdl +156 -0
  97. data/spec/fixtures/wsdl/jira.wsdl +3890 -0
  98. data/spec/fixtures/wsdl/juniper.wsdl +215 -0
  99. data/spec/fixtures/wsdl/namespaced_actions.wsdl +307 -0
  100. data/spec/fixtures/wsdl/oracle.wsdl +3629 -0
  101. data/spec/fixtures/wsdl/ratp.wsdl +955 -0
  102. data/spec/fixtures/wsdl/rio2/rio2.wsdl +74 -0
  103. data/spec/fixtures/wsdl/rio2/rio2_0.wsdl +55 -0
  104. data/spec/fixtures/wsdl/rio2/rio2_0.xsd +58 -0
  105. data/spec/fixtures/wsdl/rio2/rio2_1.xsd +41 -0
  106. data/spec/fixtures/wsdl/rio2/rio2_2.xsd +222 -0
  107. data/spec/fixtures/wsdl/rio2/rio2_3.xsd +10 -0
  108. data/spec/fixtures/wsdl/rpc_literal.wsdl +105 -0
  109. data/spec/fixtures/wsdl/spyne.wsdl +70 -0
  110. data/spec/fixtures/wsdl/stockquote.wsdl +124 -0
  111. data/spec/fixtures/wsdl/taxcloud.wsdl +934 -0
  112. data/spec/fixtures/wsdl/team_software/team_software.wsdl +542 -0
  113. data/spec/fixtures/wsdl/team_software/team_software0.xsd +448 -0
  114. data/spec/fixtures/wsdl/team_software/team_software1.xsd +41 -0
  115. data/spec/fixtures/wsdl/team_software/team_software2.xsd +258 -0
  116. data/spec/fixtures/wsdl/team_software/team_software3.xsd +14 -0
  117. data/spec/fixtures/wsdl/telefonkatalogen.wsdl +45 -0
  118. data/spec/fixtures/wsdl/temperature.wsdl +136 -0
  119. data/spec/fixtures/wsdl/wasmuth/wasmuth.wsdl +157 -0
  120. data/spec/fixtures/wsdl/wasmuth/wasmuth1.xsd +210 -0
  121. data/spec/fixtures/wsdl/wasmuth/wasmuth2.xsd +549 -0
  122. data/spec/fixtures/wsdl/xignite.wsdl +3470 -0
  123. data/spec/fixtures/wsdl/yahoo.wsdl +2425 -0
  124. data/spec/fixtures/wsdl/zanox_export_service.xml +520 -0
  125. data/spec/integration/amazon_spec.rb +51 -0
  126. data/spec/integration/authentication_spec.rb +38 -0
  127. data/spec/integration/awse_spec.rb +95 -0
  128. data/spec/integration/betfair_spec.rb +179 -0
  129. data/spec/integration/blz_service_spec.rb +46 -0
  130. data/spec/integration/bookt_spec.rb +59 -0
  131. data/spec/integration/bronto_spec.rb +178 -0
  132. data/spec/integration/bydexchange_spec.rb +40 -0
  133. data/spec/integration/crowd_spec.rb +44 -0
  134. data/spec/integration/data_exchange_spec.rb +27 -0
  135. data/spec/integration/document_literal_spec.rb +104 -0
  136. data/spec/integration/economic_spec.rb +64 -0
  137. data/spec/integration/email_verification_spec.rb +82 -0
  138. data/spec/integration/equifax_spec.rb +216 -0
  139. data/spec/integration/geotrust_spec.rb +17 -0
  140. data/spec/integration/interhome_spec.rb +156 -0
  141. data/spec/integration/iws_spec.rb +27 -0
  142. data/spec/integration/jetairways_spec.rb +142 -0
  143. data/spec/integration/jira_spec.rb +27 -0
  144. data/spec/integration/juniper_spec.rb +20 -0
  145. data/spec/integration/namespaced_actions_spec.rb +37 -0
  146. data/spec/integration/oracle_spec.rb +61 -0
  147. data/spec/integration/ratp_spec.rb +178 -0
  148. data/spec/integration/rio2_spec.rb +56 -0
  149. data/spec/integration/rpc_literal_spec.rb +101 -0
  150. data/spec/integration/spyne_spec.rb +60 -0
  151. data/spec/integration/stockquote_spec.rb +46 -0
  152. data/spec/integration/taxcloud_spec.rb +45 -0
  153. data/spec/integration/team_software_spec.rb +51 -0
  154. data/spec/integration/telefonkatalogen_spec.rb +42 -0
  155. data/spec/integration/temperature_spec.rb +71 -0
  156. data/spec/integration/wasmuth_spec.rb +47 -0
  157. data/spec/integration/xignite_spec.rb +112 -0
  158. data/spec/integration/yahoo_spec.rb +116 -0
  159. data/spec/sekken/httpclient_spec.rb +41 -0
  160. data/spec/sekken/operation/build_spec.rb +308 -0
  161. data/spec/sekken/operation/document_literal_spec.rb +53 -0
  162. data/spec/sekken/operation/example_body_spec.rb +95 -0
  163. data/spec/sekken/operation/rpc_literal_spec.rb +50 -0
  164. data/spec/sekken/operation_spec.rb +169 -0
  165. data/spec/sekken/resolver_spec.rb +38 -0
  166. data/spec/sekken/response_spec.rb +17 -0
  167. data/spec/sekken/wsdl/document_spec.rb +191 -0
  168. data/spec/sekken/wsdl_spec.rb +46 -0
  169. data/spec/sekken/xs/complex_type_spec.rb +197 -0
  170. data/spec/sekken/xs/element_spec.rb +82 -0
  171. data/spec/sekken/xs/simple_type_spec.rb +39 -0
  172. data/spec/sekken_spec.rb +128 -0
  173. data/spec/spec_helper.rb +37 -0
  174. data/spec/support/fixture.rb +19 -0
  175. data/spec/support/http_mock.rb +43 -0
  176. metadata +344 -0
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with IWS' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/iws') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to eq(
9
+ 'IWSIntegERPservice' => {
10
+ ports: {
11
+ 'IWSIntegERPPort' => {
12
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ location: 'http://177.75.152.221:8084/WSIntegERP/WSIntegERP.exe/soap/IWSIntegERP'
14
+ }
15
+ }
16
+ }
17
+ )
18
+ end
19
+
20
+ it 'raises an error because RPC/encoded operations are not ' do
21
+ service, port = 'IWSIntegERPservice', 'IWSIntegERPPort'
22
+
23
+ expect { client.operation(service, port, 'Autenticacao') }.
24
+ to raise_error(Sekken::UnsupportedStyleError, /"Autenticacao" is an "rpc\/encoded" style operation/)
25
+ end
26
+
27
+ end
@@ -0,0 +1,142 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Jetairways\'s SessionCreate Service' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/jetairways') }
6
+
7
+
8
+
9
+ let(:service_name) { :SessionCreate }
10
+ let(:port_name) { :SessionCreateSoap }
11
+
12
+ it 'returns a map of services and ports' do
13
+ expect(client.services).to eq(
14
+ 'SessionCreate'=> {
15
+ :ports=> {
16
+ 'SessionCreateSoap'=> {
17
+ :type=>'http://schemas.xmlsoap.org/wsdl/soap/',
18
+ # symbolic endpoint
19
+ :location=>'http://USE_ADDRESS_RETURNED_BY_LOCATION_SERVICE/jettaobeapi/SessionCreate.asmx'
20
+ },
21
+ 'SessionCreateSoap12'=>{
22
+ :type=>'http://schemas.xmlsoap.org/wsdl/soap12/',
23
+ # symbolic endpoint
24
+ :location=>'http://USE_ADDRESS_RETURNED_BY_LOCATION_SERVICE/jettaobeapi/SessionCreate.asmx'
25
+ }
26
+ }
27
+ }
28
+ )
29
+ end
30
+
31
+ it 'knows the operations' do
32
+ operation = client.operation(service_name, port_name, :Logon)
33
+
34
+ expect(operation.soap_action).to eq('http://www.vedaleon.com/webservices/Logon')
35
+ expect(operation.endpoint).to eq('http://USE_ADDRESS_RETURNED_BY_LOCATION_SERVICE/jettaobeapi/SessionCreate.asmx')
36
+
37
+ namespace = 'http://www.vedaleon.com/webservices'
38
+
39
+ expect(operation.body_parts).to eq([
40
+ [['Logon'], { namespace: namespace, form: 'qualified', singular: true }]
41
+ ])
42
+ end
43
+
44
+ # multiple implicit headers. reference: http://www.ibm.com/developerworks/library/ws-tip-headers/index.html
45
+ it 'creates an example header' do
46
+ operation = client.operation(service_name, port_name, :Logon)
47
+
48
+ expect(operation.example_header).to eq(
49
+ MessageHeader:
50
+ {From: {PartyId: [{}], Role: 'string'},
51
+ To: {PartyId: [{}], Role: 'string'},
52
+ CPAId: 'string',
53
+ ConversationId: 'string',
54
+ Service: {},
55
+ Action: 'string',
56
+ MessageData:
57
+ {MessageId: 'string',
58
+ Timestamp: 'string',
59
+ RefToMessageId: 'string',
60
+ TimeToLive: 'dateTime'},
61
+ DuplicateElimination: {},
62
+ Description: [{}],
63
+ _id: 's:ID',
64
+ _version: 's:string'},
65
+ Security:
66
+ {UsernameToken:
67
+ {Username: 'string',
68
+ Password: 'string',
69
+ Organization: 'string',
70
+ Domain: 'string'},
71
+ BinarySecurityToken: 'string'}
72
+ )
73
+ end
74
+
75
+ it 'creates an example body' do
76
+ operation = client.operation(service_name, port_name, :Logon)
77
+
78
+ expect(operation.example_body).to eq(
79
+ Logon:{}
80
+ )
81
+ end
82
+
83
+ it 'creates a request with multiple headers' do
84
+ operation = client.operation(service_name, port_name, :Logon)
85
+
86
+ operation.header =
87
+ {
88
+ MessageHeader:
89
+ {CPAId:"9W",
90
+ ConversationId:"1",
91
+ Service:{Service:"Create"},
92
+ Action:"CreateSession",
93
+ MessageData:
94
+ {MessageId:"0",
95
+ Timestamp:"2014-02-01T12:57:12.000Z"}
96
+ },
97
+ Security:
98
+ { UsernameToken: {
99
+ Username: 'example_user',
100
+ Password: 'my_secret',
101
+ Organization: 'example_organization'}
102
+
103
+ }
104
+ }
105
+ operation.body =
106
+ {Logon:{}}
107
+
108
+ expected = Nokogiri.XML('
109
+ <env:Envelope
110
+ xmlns:lol0="http://www.ebxml.org/namespaces/messageHeader"
111
+ xmlns:lol1="http://schemas.xmlsoap.org/ws/2002/12/secext"
112
+ xmlns:lol2="http://www.vedaleon.com/webservices"
113
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
114
+ <env:Header>
115
+ <lol0:MessageHeader>
116
+ <lol0:CPAId>9W</lol0:CPAId>
117
+ <lol0:ConversationId>1</lol0:ConversationId>
118
+ <lol0:Service>Create</lol0:Service>
119
+ <lol0:Action>CreateSession</lol0:Action>
120
+ <lol0:MessageData>
121
+ <lol0:MessageId>0</lol0:MessageId>
122
+ <lol0:Timestamp>2014-02-01T12:57:12.000Z</lol0:Timestamp>
123
+ </lol0:MessageData>
124
+ </lol0:MessageHeader>
125
+ <lol1:Security>
126
+ <lol1:UsernameToken>
127
+ <lol1:Username>example_user</lol1:Username>
128
+ <lol1:Password>my_secret</lol1:Password>
129
+ <Organization>example_organization</Organization>
130
+ </lol1:UsernameToken>
131
+ </lol1:Security>
132
+ </env:Header>
133
+ <env:Body>
134
+ <lol2:Logon/>
135
+ </env:Body>
136
+ ')
137
+
138
+ expect(Nokogiri.XML operation.build).
139
+ to be_equivalent_to(expected).respecting_element_order
140
+ end
141
+
142
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Atlassian Jira' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/jira') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to eq(
9
+ 'JiraSoapServiceService' => {
10
+ :ports => {
11
+ 'jirasoapservice-v2' => {
12
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ :location => 'https://jira.atlassian.com/rpc/soap/jirasoapservice-v2'
14
+ }
15
+ }
16
+ }
17
+ )
18
+ end
19
+
20
+ it 'raises an error because RPC/encoded operations are not ' do
21
+ service, port = 'JiraSoapServiceService', 'jirasoapservice-v2'
22
+
23
+ expect { client.operation(service, port, 'updateGroup') }.
24
+ to raise_error(Sekken::UnsupportedStyleError, /"updateGroup" is an "rpc\/encoded" style operation/)
25
+ end
26
+
27
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe 'Integration with Juniper' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/juniper') }
6
+
7
+ it 'skips the relative schema import to still show other information' do
8
+ expect(client.services).to eq(
9
+ 'SystemService' => {
10
+ :ports => {
11
+ 'System' => {
12
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ :location => 'https://10.1.1.1:8443/axis2/services/SystemService'
14
+ }
15
+ }
16
+ }
17
+ )
18
+ end
19
+
20
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with namespaced actions example' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/namespaced_actions') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to eq(
9
+ 'api' => {
10
+ :ports => {
11
+ 'apiSoap' => {
12
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ :location => 'https://api.example.com/api/api.asmx'
14
+ },
15
+ 'apiSoap12' => {
16
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
17
+ :location => 'https://api.example.com/api/api.asmx'
18
+ }
19
+ }
20
+ }
21
+ )
22
+ end
23
+
24
+ it 'works fine with dot-namespaced operations' do
25
+ operation = client.operation('api', 'apiSoap', 'DeleteClient')
26
+
27
+ expect(operation.soap_action).to eq('http://api.example.com/api/Client.Delete')
28
+ expect(operation.endpoint).to eq('https://api.example.com/api/api.asmx')
29
+
30
+ expect(operation.body_parts).to eq([
31
+ [['Client.Delete'], { namespace: 'http://api.example.com/api/', form: 'qualified', singular: true }],
32
+ [['Client.Delete', 'ApiKey'], { namespace: 'http://api.example.com/api/', form: 'qualified', singular: true, type: 's:string' }],
33
+ [['Client.Delete', 'ClientID'], { namespace: 'http://api.example.com/api/', form: 'qualified', singular: true, type: 's:string' }]
34
+ ])
35
+ end
36
+
37
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Oracle' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/oracle') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to include(
9
+ 'SAWSessionService' => {
10
+ ports: {
11
+ 'SAWSessionServiceSoap' => {
12
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ location: 'https://fap0023-bi.oracleads.com/analytics-ws/saw.dll?SoapImpl=nQSessionService'
14
+ }
15
+ }
16
+ },
17
+ 'WebCatalogService' => {
18
+ ports: {
19
+ 'WebCatalogServiceSoap' => {
20
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
21
+ location: 'https://fap0023-bi.oracleads.com/analytics-ws/saw.dll?SoapImpl=webCatalogService'
22
+ }
23
+ }
24
+ },
25
+ 'XmlViewService' => {
26
+ ports: {
27
+ 'XmlViewServiceSoap' => {
28
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
29
+ location: 'https://fap0023-bi.oracleads.com/analytics-ws/saw.dll?SoapImpl=xmlViewService'
30
+ }
31
+ }
32
+ }
33
+ )
34
+ end
35
+
36
+ it 'knows the operations' do
37
+ service, port = 'SecurityService', 'SecurityServiceSoap'
38
+ operation = client.operation(service, port, 'joinGroups')
39
+
40
+ expect(operation.soap_action).to eq('#joinGroups')
41
+ expect(operation.endpoint).to eq('https://fap0023-bi.oracleads.com/analytics-ws/saw.dll?SoapImpl=securityService')
42
+
43
+ namespace = 'urn://oracle.bi.webservices/v7'
44
+
45
+ expect(operation.body_parts).to eq([
46
+ [['joinGroups'], { namespace: namespace, form: 'qualified', singular: true }],
47
+ [['joinGroups', 'group'], { namespace: namespace, form: 'qualified', singular: false }],
48
+ [['joinGroups', 'group', 'name'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
49
+ [['joinGroups', 'group', 'accountType'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:int' }],
50
+ [['joinGroups', 'group', 'guid'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
51
+ [['joinGroups', 'group', 'displayName'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
52
+ [['joinGroups', 'member'], { namespace: namespace, form: 'qualified', singular: false }],
53
+ [['joinGroups', 'member', 'name'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
54
+ [['joinGroups', 'member', 'accountType'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:int' }],
55
+ [['joinGroups', 'member', 'guid'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
56
+ [['joinGroups', 'member', 'displayName'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }],
57
+ [['joinGroups', 'sessionID'], { namespace: namespace, form: 'qualified', singular: true, type: 'xsd:string' }]
58
+ ])
59
+ end
60
+
61
+ end
@@ -0,0 +1,178 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with RATP' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/ratp') }
6
+
7
+ let(:service_name) { :Wsiv }
8
+ let(:port_name) { :WsivSOAP11port_http }
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(client.services).to eq(
12
+ 'Wsiv' => {
13
+ :ports => {
14
+ 'WsivSOAP11port_http' => {
15
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ :location => 'http://www.ratp.fr/wsiv/services/Wsiv'
17
+ },
18
+ 'WsivSOAP12port_http' => {
19
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
20
+ :location => 'http://www.ratp.fr/wsiv/services/Wsiv'
21
+ }
22
+ }
23
+ }
24
+ )
25
+ end
26
+
27
+ it 'gracefully handle recursive type definitions' do
28
+ service, port = 'Wsiv', 'WsivSOAP11port_http'
29
+ operation = client.operation(service, port, 'getStations')
30
+
31
+ expect(operation.soap_action).to eq('urn:getStations')
32
+ expect(operation.endpoint).to eq('http://www.ratp.fr/wsiv/services/Wsiv')
33
+
34
+ ns1 = 'http://wsiv.ratp.fr'
35
+ ns2 = 'http://wsiv.ratp.fr/xsd'
36
+
37
+ expect(operation.body_parts).to eq([
38
+ [['getStations'], { namespace: ns1, form: 'qualified', singular: true }],
39
+ [['getStations', 'station'], { namespace: ns1, form: 'qualified', singular: true }],
40
+ [['getStations', 'station', 'direction'], { namespace: ns2, form: 'qualified', singular: true }],
41
+ [['getStations', 'station', 'direction', 'line'], { namespace: ns2, form: 'qualified', singular: true }],
42
+ [['getStations', 'station', 'direction', 'line', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
43
+ [['getStations', 'station', 'direction', 'line', 'codeStif'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
44
+ [['getStations', 'station', 'direction', 'line', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
45
+ [['getStations', 'station', 'direction', 'line', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
46
+ [['getStations', 'station', 'direction', 'line', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
47
+ [['getStations', 'station', 'direction', 'line', 'realm'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
48
+ [['getStations', 'station', 'direction', 'line', 'reseau'], { namespace: ns2, form: 'qualified', singular: true }],
49
+ [['getStations', 'station', 'direction', 'line', 'reseau', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
50
+ [['getStations', 'station', 'direction', 'line', 'reseau', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
51
+ [['getStations', 'station', 'direction', 'line', 'reseau', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
52
+ [['getStations', 'station', 'direction', 'line', 'reseau', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
53
+ [['getStations', 'station', 'direction', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
54
+ [['getStations', 'station', 'direction', 'sens'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
55
+
56
+ [['getStations', 'station', 'direction', 'stationsEndLine'],
57
+ # Notice how this recursively references its parent type, so we return the
58
+ # type it references as the :recursive_type.
59
+ { namespace: ns2, form: 'qualified', singular: false, recursive_type: 'ax21:Station' }],
60
+
61
+ [['getStations', 'station', 'geoPointA'], { namespace: ns2, form: 'qualified', singular: true }],
62
+ [['getStations', 'station', 'geoPointA', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
63
+ [['getStations', 'station', 'geoPointA', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
64
+ [['getStations', 'station', 'geoPointA', 'nameSuffix'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
65
+ [['getStations', 'station', 'geoPointA', 'type'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
66
+ [['getStations', 'station', 'geoPointA', 'x'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
67
+ [['getStations', 'station', 'geoPointA', 'y'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
68
+ [['getStations', 'station', 'geoPointR'], { namespace: ns2, form: 'qualified', singular: true }],
69
+ [['getStations', 'station', 'geoPointR', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
70
+ [['getStations', 'station', 'geoPointR', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
71
+ [['getStations', 'station', 'geoPointR', 'nameSuffix'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
72
+ [['getStations', 'station', 'geoPointR', 'type'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
73
+ [['getStations', 'station', 'geoPointR', 'x'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
74
+ [['getStations', 'station', 'geoPointR', 'y'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
75
+ [['getStations', 'station', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
76
+ [['getStations', 'station', 'idsNextA'], { namespace: ns2, form: 'qualified', singular: false, type: 'xs:string' }],
77
+ [['getStations', 'station', 'idsNextR'], { namespace: ns2, form: 'qualified', singular: false, type: 'xs:string' }],
78
+ [['getStations', 'station', 'line'], { namespace: ns2, form: 'qualified', singular: true }],
79
+ [['getStations', 'station', 'line', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
80
+ [['getStations', 'station', 'line', 'codeStif'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
81
+ [['getStations', 'station', 'line', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
82
+ [['getStations', 'station', 'line', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
83
+ [['getStations', 'station', 'line', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
84
+ [['getStations', 'station', 'line', 'realm'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
85
+ [['getStations', 'station', 'line', 'reseau'], { namespace: ns2, form: 'qualified', singular: true }],
86
+ [['getStations', 'station', 'line', 'reseau', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
87
+ [['getStations', 'station', 'line', 'reseau', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
88
+ [['getStations', 'station', 'line', 'reseau', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
89
+ [['getStations', 'station', 'line', 'reseau', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
90
+ [['getStations', 'station', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
91
+ [['getStations', 'station', 'stationArea'], { namespace: ns2, form: 'qualified', singular: true }],
92
+ [['getStations', 'station', 'stationArea', 'access'], { namespace: ns2, form: 'qualified', singular: false }],
93
+ [['getStations', 'station', 'stationArea', 'access', 'address'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
94
+ [['getStations', 'station', 'stationArea', 'access', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
95
+ [['getStations', 'station', 'stationArea', 'access', 'index'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
96
+ [['getStations', 'station', 'stationArea', 'access', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
97
+ [['getStations', 'station', 'stationArea', 'access', 'timeDaysLabel'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
98
+ [['getStations', 'station', 'stationArea', 'access', 'timeDaysStatus'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
99
+ [['getStations', 'station', 'stationArea', 'access', 'timeEnd'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
100
+ [['getStations', 'station', 'stationArea', 'access', 'timeStart'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
101
+ [['getStations', 'station', 'stationArea', 'access', 'x'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
102
+ [['getStations', 'station', 'stationArea', 'access', 'y'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
103
+ [['getStations', 'station', 'stationArea', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
104
+ [['getStations', 'station', 'stationArea', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
105
+
106
+ [['getStations', 'station', 'stationArea', 'stations'],
107
+ # Another recursive type definition.
108
+ { namespace: ns2, form: 'qualified', singular: false, recursive_type: 'ax21:Station' }],
109
+
110
+ [['getStations', 'station', 'stationArea', 'tarifsToParis'], { namespace: ns2, form: 'qualified', singular: false }],
111
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'demiTarif'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:float' }],
112
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'pleinTarif'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:float' }],
113
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine'], { namespace: ns2, form: 'qualified', singular: true }],
114
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
115
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'codeStif'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
116
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
117
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
118
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
119
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'realm'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
120
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'reseau'], { namespace: ns2, form: 'qualified', singular: true }],
121
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'reseau', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
122
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'reseau', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
123
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'reseau', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
124
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaLine', 'reseau', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
125
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaReseau'], { namespace: ns2, form: 'qualified', singular: true }],
126
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaReseau', 'code'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
127
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaReseau', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
128
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaReseau', 'image'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
129
+ [['getStations', 'station', 'stationArea', 'tarifsToParis', 'viaReseau', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
130
+ [['getStations', 'station', 'stationArea', 'zoneCarteOrange'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
131
+
132
+ [['getStations', 'gp'], { namespace: ns1, form: 'qualified', singular: true }],
133
+ [['getStations', 'gp', 'id'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
134
+ [['getStations', 'gp', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
135
+ [['getStations', 'gp', 'nameSuffix'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
136
+ [['getStations', 'gp', 'type'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:string' }],
137
+ [['getStations', 'gp', 'x'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
138
+ [['getStations', 'gp', 'y'], { namespace: ns2, form: 'qualified', singular: true, type: 'xs:double' }],
139
+ [['getStations', 'distances'], { namespace: ns1, form: 'qualified', singular: false, type: 'xs:int' }],
140
+ [['getStations', 'limit'], { namespace: ns1, form: 'qualified', singular: true, type: 'xs:int' }],
141
+ [['getStations', 'sortAlpha'], { namespace: ns1, form: 'qualified', singular: true, type: 'xs:boolean' }]
142
+ ])
143
+ end
144
+
145
+ it 'builds a request' do
146
+ operation = client.operation(service_name, port_name, :getStations)
147
+
148
+ operation.body = {
149
+ getStations: {
150
+ station: {
151
+ id: 1975
152
+ },
153
+ limit: 1
154
+ }
155
+ }
156
+
157
+ expected = Nokogiri.XML(%{
158
+ <env:Envelope
159
+ xmlns:lol0="http://wsiv.ratp.fr"
160
+ xmlns:lol1="http://wsiv.ratp.fr/xsd"
161
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
162
+ <env:Header/>
163
+ <env:Body>
164
+ <lol0:getStations>
165
+ <lol0:station>
166
+ <lol1:id>1975</lol1:id>
167
+ </lol0:station>
168
+ <lol0:limit>1</lol0:limit>
169
+ </lol0:getStations>
170
+ </env:Body>
171
+ </env:Envelope>
172
+ })
173
+
174
+ expect(Nokogiri.XML operation.build).
175
+ to be_equivalent_to(expected).respecting_element_order
176
+ end
177
+
178
+ end