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,178 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Bronto' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/bronto') }
6
+
7
+ let(:service_name) { :BrontoSoapApiImplService }
8
+ let(:port_name) { :BrontoSoapApiImplPort }
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(client.services).to eq(
12
+ 'BrontoSoapApiImplService' => {
13
+ ports: {
14
+ 'BrontoSoapApiImplPort' => {
15
+ type: 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ location: 'https://api.bronto.com/v4'
17
+ }
18
+ }
19
+ }
20
+ )
21
+ end
22
+
23
+ it 'knows the operations' do
24
+ operation = client.operation(service_name, port_name, :addLogins)
25
+
26
+ expect(operation.soap_action).to eq('')
27
+ expect(operation.endpoint).to eq('https://api.bronto.com/v4')
28
+
29
+ namespace = 'http://api.bronto.com/v4'
30
+
31
+ expect(operation.body_parts).to eq([
32
+ [['addLogins'], { namespace: namespace, form: 'qualified', singular: true }],
33
+ [['addLogins', 'accounts'], { namespace: namespace, form: 'unqualified', singular: false }],
34
+ [['addLogins', 'accounts', 'username'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
35
+ [['addLogins', 'accounts', 'password'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
36
+ [['addLogins', 'accounts', 'contactInformation'], { namespace: namespace, form: 'unqualified', singular: true }],
37
+ [['addLogins', 'accounts', 'contactInformation', 'organization'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
38
+ [['addLogins', 'accounts', 'contactInformation', 'firstName'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
39
+ [['addLogins', 'accounts', 'contactInformation', 'lastName'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
40
+ [['addLogins', 'accounts', 'contactInformation', 'email'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
41
+ [['addLogins', 'accounts', 'contactInformation', 'phone'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
42
+ [['addLogins', 'accounts', 'contactInformation', 'address'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
43
+ [['addLogins', 'accounts', 'contactInformation', 'address2'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
44
+ [['addLogins', 'accounts', 'contactInformation', 'city'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
45
+ [['addLogins', 'accounts', 'contactInformation', 'state'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
46
+ [['addLogins', 'accounts', 'contactInformation', 'zip'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
47
+ [['addLogins', 'accounts', 'contactInformation', 'country'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
48
+ [['addLogins', 'accounts', 'contactInformation', 'notes'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:string' }],
49
+ [['addLogins', 'accounts', 'permissionAgencyAdmin'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
50
+ [['addLogins', 'accounts', 'permissionAdmin'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
51
+ [['addLogins', 'accounts', 'permissionApi'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
52
+ [['addLogins', 'accounts', 'permissionUpgrade'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
53
+ [['addLogins', 'accounts', 'permissionFatigueOverride'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
54
+ [['addLogins', 'accounts', 'permissionMessageCompose'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
55
+ [['addLogins', 'accounts', 'permissionMessageApprove'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
56
+ [['addLogins', 'accounts', 'permissionMessageDelete'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
57
+ [['addLogins', 'accounts', 'permissionAutomatorCompose'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
58
+ [['addLogins', 'accounts', 'permissionListCreateSend'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
59
+ [['addLogins', 'accounts', 'permissionListCreate'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
60
+ [['addLogins', 'accounts', 'permissionSegmentCreate'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
61
+ [['addLogins', 'accounts', 'permissionFieldCreate'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
62
+ [['addLogins', 'accounts', 'permissionFieldReorder'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
63
+ [['addLogins', 'accounts', 'permissionSubscriberCreate'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }],
64
+ [['addLogins', 'accounts', 'permissionSubscriberView'], { namespace: namespace, form: 'unqualified', singular: true, type: 'xs:boolean' }]
65
+ ])
66
+ end
67
+
68
+ # explicit headers. reference: http://www.ibm.com/developerworks/library/ws-tip-headers/index.html
69
+ it 'creates an example header' do
70
+ operation = client.operation(service_name, port_name, :addLogins)
71
+
72
+ expect(operation.example_header).to eq(
73
+ sessionHeader: {
74
+ sessionId: 'string'
75
+ }
76
+ )
77
+ end
78
+
79
+ it 'creates an example body' do
80
+ operation = client.operation(service_name, port_name, :addLogins)
81
+
82
+ expect(operation.example_body).to eq(
83
+ addLogins: {
84
+ accounts: [
85
+ {
86
+ username: 'string',
87
+ password: 'string',
88
+ contactInformation: {
89
+ organization: 'string',
90
+ firstName: 'string',
91
+ lastName: 'string',
92
+ email: 'string',
93
+ phone: 'string',
94
+ address: 'string',
95
+ address2: 'string',
96
+ city: 'string',
97
+ state: 'string',
98
+ zip: 'string',
99
+ country: 'string',
100
+ notes: 'string'
101
+ },
102
+ permissionAgencyAdmin: 'boolean',
103
+ permissionAdmin: 'boolean',
104
+ permissionApi: 'boolean',
105
+ permissionUpgrade: 'boolean',
106
+ permissionFatigueOverride: 'boolean',
107
+ permissionMessageCompose: 'boolean',
108
+ permissionMessageApprove: 'boolean',
109
+ permissionMessageDelete: 'boolean',
110
+ permissionAutomatorCompose: 'boolean',
111
+ permissionListCreateSend: 'boolean',
112
+ permissionListCreate: 'boolean',
113
+ permissionSegmentCreate: 'boolean',
114
+ permissionFieldCreate: 'boolean',
115
+ permissionFieldReorder: 'boolean',
116
+ permissionSubscriberCreate: 'boolean',
117
+ permissionSubscriberView: 'boolean'
118
+ }
119
+ ]
120
+ }
121
+ )
122
+ end
123
+
124
+ it 'creates a request with a header' do
125
+ operation = client.operation(service_name, port_name, :addLogins)
126
+
127
+ operation.header = {
128
+ sessionHeader: {
129
+ sessionId: '23'
130
+ }
131
+ }
132
+
133
+ operation.body = {
134
+ addLogins: {
135
+ accounts: [
136
+ {
137
+ username: 'admin',
138
+ password: 'secert',
139
+ contactInformation: {
140
+ firstName: 'brew',
141
+ email: 'brew@example.com',
142
+ },
143
+ permissionApi: true,
144
+ }
145
+ ]
146
+ }
147
+ }
148
+
149
+ expected = Nokogiri.XML('
150
+ <env:Envelope
151
+ xmlns:lol0="http://api.bronto.com/v4"
152
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
153
+ <env:Header>
154
+ <lol0:sessionHeader>
155
+ <sessionId>23</sessionId>
156
+ </lol0:sessionHeader>
157
+ </env:Header>
158
+ <env:Body>
159
+ <lol0:addLogins>
160
+ <accounts>
161
+ <username>admin</username>
162
+ <password>secert</password>
163
+ <contactInformation>
164
+ <firstName>brew</firstName>
165
+ <email>brew@example.com</email>
166
+ </contactInformation>
167
+ <permissionApi>true</permissionApi>
168
+ </accounts>
169
+ </lol0:addLogins>
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
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with BYDExchange' 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
+ let(:wsdl2_url) { 'http://bydexchange.nbs-us.com/BYDExchangeServer.svc?wsdl=wsdl0' }
9
+
10
+ before do
11
+ http_mock.fake_request(wsdl_url, 'wsdl/bydexchange/bydexchange.wsdl')
12
+ http_mock.fake_request(wsdl2_url, 'wsdl/bydexchange/bydexchange2.wsdl')
13
+
14
+ # 8 schemas to import
15
+ schema_import_base = 'http://bydexchange.nbs-us.com/BYDExchangeServer.svc?xsd=xsd%d'
16
+ (0..8).each do |i|
17
+ url = schema_import_base % i
18
+ http_mock.fake_request(url, "wsdl/bydexchange/bydexchange#{i}.xsd")
19
+ end
20
+ end
21
+
22
+ it 'returns a map of services and ports' do
23
+ expect(client.services).to eq(
24
+ 'BYDExchangeServer' => {
25
+ :ports => {
26
+ 'BasicHttpBinding_IBYDExchangeServer' => {
27
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
28
+ :location => 'http://bydexchange.nbs-us.com/BYDExchangeServer.svc'
29
+ }
30
+ }
31
+ }
32
+ )
33
+ end
34
+
35
+ it 'resolves WSDL imports to get the operations' do
36
+ operations = client.operations('BYDExchangeServer', 'BasicHttpBinding_IBYDExchangeServer')
37
+ expect(operations).to include('GetCustomer')
38
+ end
39
+
40
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with Atlassian Crowd' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/crowd') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to eq(
9
+ 'SecurityServer' => {
10
+ :ports => {
11
+ 'SecurityServerHttpPort' => {
12
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ :location => 'http://magnesium:8095/crowd/services/SecurityServer'
14
+ }
15
+ }
16
+ }
17
+ )
18
+ end
19
+
20
+ it 'knows the operations' do
21
+ service, port = 'SecurityServer', 'SecurityServerHttpPort'
22
+ operation = client.operation(service, port, 'addAttributeToGroup')
23
+
24
+ expect(operation.soap_action).to eq('')
25
+ expect(operation.endpoint).to eq('http://magnesium:8095/crowd/services/SecurityServer')
26
+
27
+ ns1 = 'urn:SecurityServer'
28
+ ns2 = 'http://authentication.integration.crowd.atlassian.com'
29
+ ns3 = 'http://soap.integration.crowd.atlassian.com'
30
+
31
+ expect(operation.body_parts).to eq([
32
+ [['addAttributeToGroup'], { namespace: ns1, form: 'qualified', singular: true }],
33
+ [['addAttributeToGroup', 'in0'], { namespace: ns1, form: 'qualified', singular: true }],
34
+ [['addAttributeToGroup', 'in0', 'name'], { namespace: ns2, form: 'qualified', singular: true, type: 'xsd:string' }],
35
+ [['addAttributeToGroup', 'in0', 'token'], { namespace: ns2, form: 'qualified', singular: true, type: 'xsd:string' }],
36
+ [['addAttributeToGroup', 'in1'], { namespace: ns1, form: 'qualified', singular: true, type: 'xsd:string' }],
37
+ [['addAttributeToGroup', 'in2'], { namespace: ns1, form: 'qualified', singular: true }],
38
+ [['addAttributeToGroup', 'in2', 'name'], { namespace: ns3, form: 'qualified', singular: true, type: 'xsd:string' }],
39
+ [['addAttributeToGroup', 'in2', 'values'], { namespace: ns3, form: 'qualified', singular: true }],
40
+ [['addAttributeToGroup', 'in2', 'values', 'string'], { namespace: ns1, form: 'qualified', singular: false, type: 'xsd:string' }]
41
+ ])
42
+ end
43
+
44
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with DataExchange' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/data_exchange') }
6
+
7
+ it 'returns a map of services and ports' do
8
+ expect(client.services).to eq(
9
+ 'DataExchange' => {
10
+ :ports => {
11
+ 'DataExchange' => {
12
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
13
+ :location => 'http://my.yfu.org/cgi-bin/WebObjects/WebService.woa/ws/DataExchange'
14
+ }
15
+ }
16
+ }
17
+ )
18
+ end
19
+
20
+ it 'raises an error because RPC/encoded operations are not ' do
21
+ service = port = 'DataExchange'
22
+
23
+ expect { client.operation(service, port, 'submit') }.
24
+ to raise_error(Sekken::UnsupportedStyleError, /"submit" is an "rpc\/encoded" style operation/)
25
+ end
26
+
27
+ end
@@ -0,0 +1,104 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Integration with a Document/Literal example' do
4
+
5
+ subject(:client) { Sekken.new fixture('wsdl/document_literal_wrapped') }
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
+ expect(op1.example_body).to eq(
14
+ op1: {
15
+ in: {
16
+ data1: 'int',
17
+ data2: 'int'
18
+ }
19
+ }
20
+ )
21
+
22
+ op1.body = {
23
+ op1: {
24
+ in: {
25
+ data1: 24,
26
+ data2: 36
27
+ }
28
+ }
29
+ }
30
+
31
+ # The expected request.
32
+ expected = Nokogiri.XML('
33
+ <env:Envelope
34
+ xmlns:lol0="http://apiNamespace.com"
35
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
36
+ <env:Header/>
37
+ <env:Body>
38
+ <lol0:op1>
39
+ <in>
40
+ <data1>24</data1>
41
+ <data2>36</data2>
42
+ </in>
43
+ </lol0:op1>
44
+ </env:Body>
45
+ </env:Envelope>
46
+ ')
47
+
48
+ expect(Nokogiri.XML op1.build).
49
+ to be_equivalent_to(expected).respecting_element_order
50
+ end
51
+
52
+ it 'works with op3' do
53
+ op3 = client.operation(service_name, port_name, :op3)
54
+
55
+ expect(op3.example_body).to eq(
56
+ op3: {
57
+ DataElem: {
58
+ data1: 'int',
59
+ data2: 'int'
60
+ },
61
+ in2: {
62
+ RefDataElem: 'int'
63
+ }
64
+ }
65
+ )
66
+
67
+ op3.body = {
68
+ op3: {
69
+ DataElem: {
70
+ data1: 64,
71
+ data2: 128
72
+ },
73
+ in2: {
74
+ RefDataElem: 3
75
+ }
76
+ }
77
+ }
78
+
79
+ expected = Nokogiri.XML('
80
+ <env:Envelope
81
+ xmlns:lol0="http://apiNamespace.com"
82
+ xmlns:lol1="http://dataNamespace.com"
83
+ xmlns:lol2="http://refNamespace.com"
84
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
85
+ <env:Header/>
86
+ <env:Body>
87
+ <lol0:op3>
88
+ <lol1:DataElem>
89
+ <data1>64</data1>
90
+ <data2>128</data2>
91
+ </lol1:DataElem>
92
+ <in2>
93
+ <lol2:RefDataElem>3</lol2:RefDataElem>
94
+ </in2>
95
+ </lol0:op3>
96
+ </env:Body>
97
+ </env:Envelope>
98
+ ')
99
+
100
+ expect(Nokogiri.XML op3.build).
101
+ to be_equivalent_to(expected).respecting_element_order
102
+ end
103
+
104
+ end
@@ -0,0 +1,64 @@
1
+ require 'spec_helper'
2
+ require 'benchmark'
3
+
4
+ describe 'Integration with Economic' do
5
+
6
+ before :all do
7
+ @client = Sekken.new fixture('wsdl/economic')
8
+ end
9
+
10
+ it 'returns a map of services and ports' do
11
+ expect(@client.services).to eq(
12
+ 'EconomicWebService' => {
13
+ :ports => {
14
+ 'EconomicWebServiceSoap' => {
15
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap/',
16
+ :location => 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx'
17
+ },
18
+ 'EconomicWebServiceSoap12' => {
19
+ :type => 'http://schemas.xmlsoap.org/wsdl/soap12/',
20
+ :location => 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx'
21
+ }
22
+ }
23
+ }
24
+ )
25
+ end
26
+
27
+ it 'knows operations with Arrays' do
28
+ service, port = 'EconomicWebService', 'EconomicWebServiceSoap'
29
+ operation = @client.operation(service, port, 'Account_GetDataArray')
30
+
31
+ expect(operation.soap_action).to eq('http://e-conomic.com/Account_GetDataArray')
32
+ expect(operation.endpoint).to eq('https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx')
33
+
34
+ namespace = 'http://e-conomic.com'
35
+
36
+ expect(operation.body_parts).to eq([
37
+ [['Account_GetDataArray'], { namespace: namespace, form: 'qualified', singular: true }],
38
+ [['Account_GetDataArray', 'entityHandles'], { namespace: namespace, form: 'qualified', singular: true }],
39
+ [['Account_GetDataArray', 'entityHandles', 'AccountHandle'], { namespace: namespace, form: 'qualified', singular: false }],
40
+ [['Account_GetDataArray', 'entityHandles', 'AccountHandle', 'Number'], { namespace: namespace, form: 'qualified', type: 's:int', singular: true }]
41
+ ])
42
+ end
43
+
44
+ it 'has an ok parse-time for huge wsdl files' do
45
+ if RUBY_ENGINE =~ /rbx/
46
+ parse_time = Benchmark.realtime {
47
+ @client.operations('EconomicWebService', 'EconomicWebServiceSoap')
48
+ }
49
+
50
+ pending 'This currently takes %.2f sec on Rubinius. Investigate why!' % parse_time
51
+ else
52
+ #profiler = MethodProfiler.observe(Wasabi::Parser)
53
+ parse_time = Benchmark.realtime {
54
+ @client.operations('EconomicWebService', 'EconomicWebServiceSoap')
55
+ }
56
+ #puts profiler.report
57
+
58
+ # this probably needs to be increased for travis or other rubies,
59
+ # but it should prevent major performance problems.
60
+ expect(parse_time).to be < 1.0
61
+ end
62
+ end
63
+
64
+ end