soap4juddi 0.1.10 → 0.1.11
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 +4 -4
- data/lib/soap4juddi/broker.rb +48 -27
- data/lib/soap4juddi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aa704713a3987adc9b8ad09abf4d15f9c7353d8
|
4
|
+
data.tar.gz: e27b11a2a99b6f10d04f5b5c1a0f76df3ec49986
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17268df6f47e68f26ad3f85e629aaf956913d897459f09855b75cbc12206b98ef5f4405ff5f2f7cf82443d7b4e9906b941a7614cb75d9faf34d5bc7cfded3bd3
|
7
|
+
data.tar.gz: 5bab4343e05df97c8469b1cae7e23fcb7387f1f53d943a6be70fa5c8a2bd4ed3215d1406ca74f9917e28294e88249e1f9a15d20f7125aabb0b3ce4d09d595e53
|
data/lib/soap4juddi/broker.rb
CHANGED
@@ -15,7 +15,7 @@ module Soap4juddi
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def save_element_bindings(service, bindings, urn, description)
|
18
|
-
|
18
|
+
validate_elements(bindings, 'bindings')
|
19
19
|
body = auth_body
|
20
20
|
body = add_bindings(body, service, bindings, urn, description)
|
21
21
|
@soap_connector.request_soap(@base_uri, 'publishv2', 'save_binding', body) do | res|
|
@@ -23,32 +23,13 @@ module Soap4juddi
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def save_business(key, name,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
xml = @soap_xml.element_with_value('description', desc, {'xml:lang' => 'en'})
|
31
|
-
body = "#{body}#{xml}" if desc and not (desc == "")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
if (contacts) and (not contacts.empty?)
|
35
|
-
# byebug
|
36
|
-
contacts_xml = ""
|
37
|
-
contacts.each do |contact|
|
38
|
-
# contact_details = "<contact useType='(Job Title, Role)'> <description>Primary Contact</description> <personName>Ernst</personName> <phone useType='(Extension, Domestic, International, DSN)'>0217881441</phone> <email useType='Email'>ernst@b.com</email> </contact>"
|
39
|
-
|
40
|
-
contact_details = "<contact useType='(Job Title, Role)'> <description>#{contact['description']}</description> <personName>#{contact['name']}</personName> <phone useType='(Extension, Domestic, International, DSN)'>#{contact['phone']}</phone> <email useType='Email'>#{contact['email']}</email> </contact>"
|
41
|
-
|
42
|
-
contacts_xml = contacts_xml + contact_details
|
43
|
-
end
|
44
|
-
xml = @soap_xml.element_with_value("contacts", contacts_xml)
|
45
|
-
body = "#{body}#{xml}" if xml and not (xml == "")
|
46
|
-
end
|
47
|
-
|
48
|
-
businessEntity = @soap_xml.element_with_value('businessEntity', body, {'businessKey' => key})
|
26
|
+
def save_business(key, name, descriptions, contacts)
|
27
|
+
validate_elements(contacts, 'contacts')
|
28
|
+
validate_elements(descriptions, 'descriptions')
|
29
|
+
body = build_business_entity(key, name, descriptions, contacts)
|
49
30
|
@soap_connector.request_soap(@base_uri,
|
50
31
|
'publishv2', 'save_business',
|
51
|
-
"#{auth_body} #{
|
32
|
+
"#{auth_body} #{body}") do | res|
|
52
33
|
extract_business(res.body)
|
53
34
|
end
|
54
35
|
end
|
@@ -200,6 +181,21 @@ module Soap4juddi
|
|
200
181
|
end
|
201
182
|
|
202
183
|
private
|
184
|
+
|
185
|
+
def add_descriptions(body, descriptions)
|
186
|
+
if descriptions
|
187
|
+
descriptions.each do |desc|
|
188
|
+
body = add_description(body, desc)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
body
|
192
|
+
end
|
193
|
+
|
194
|
+
def add_description(body, desc)
|
195
|
+
xml = @soap_xml.element_with_value('description', desc, {'xml:lang' => 'en'})
|
196
|
+
body = "#{body}#{xml}" if desc and not (desc == "")
|
197
|
+
body
|
198
|
+
end
|
203
199
|
|
204
200
|
def add_bindings(body, service, bindings, urn, description)
|
205
201
|
if (not bindings.nil?) and (not (bindings.size == 0))
|
@@ -210,6 +206,31 @@ module Soap4juddi
|
|
210
206
|
body
|
211
207
|
end
|
212
208
|
|
209
|
+
def add_contacts(body, contacts)
|
210
|
+
if (contacts) and (not contacts.empty?)
|
211
|
+
# byebug
|
212
|
+
contacts_xml = add_contacts_to_xml("", contacts)
|
213
|
+
xml = @soap_xml.element_with_value("contacts", contacts_xml)
|
214
|
+
body = "#{body}#{xml}" if xml and not (xml == "")
|
215
|
+
end
|
216
|
+
body
|
217
|
+
end
|
218
|
+
|
219
|
+
def add_contacts_to_xml(contacts_xml, contacts)
|
220
|
+
contacts.each do |contact|
|
221
|
+
contact_details = "<contact useType='(Job Title, Role)'> <description>#{contact['description']}</description> <personName>#{contact['name']}</personName> <phone useType='(Extension, Domestic, International, DSN)'>#{contact['phone']}</phone> <email useType='Email'>#{contact['email']}</email> </contact>"
|
222
|
+
contacts_xml = contacts_xml + contact_details
|
223
|
+
end
|
224
|
+
contacts_xml
|
225
|
+
end
|
226
|
+
|
227
|
+
def build_business_entity(key, name, descriptions, contacts)
|
228
|
+
body = @soap_xml.element_with_value("name", name)
|
229
|
+
body = add_descriptions(body, descriptions)
|
230
|
+
body = add_contacts(body, contacts)
|
231
|
+
@soap_xml.element_with_value('businessEntity', body, {'businessKey' => key})
|
232
|
+
end
|
233
|
+
|
213
234
|
def add_binding(body, service, binding, urn, description)
|
214
235
|
access_point = @soap_xml.element_with_value('accessPoint', binding, {'URLType' => extract_binding_url_type(binding)})
|
215
236
|
description_data = @soap_xml.element_with_value('description', description)
|
@@ -221,8 +242,8 @@ module Soap4juddi
|
|
221
242
|
body + bindingTemplate
|
222
243
|
end
|
223
244
|
|
224
|
-
def
|
225
|
-
raise Soap4juddi::InvalidElementError.new(
|
245
|
+
def validate_elements(elements, label)
|
246
|
+
raise Soap4juddi::InvalidElementError.new("invalid #{label}") if not elements.is_a?(Array)
|
226
247
|
true
|
227
248
|
end
|
228
249
|
|
data/lib/soap4juddi/version.rb
CHANGED