soap4juddi 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/soap4juddi/broker.rb +34 -30
- 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: 63b7ba4fd1ca7454d882986406bec8d63a549c85
|
4
|
+
data.tar.gz: 18445ab17e4d243320447aa39783a463325db4a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0497a9b0b8c9e9aa16f013e9af57bce2a59c08f55856e67b0bc331da13879a3fad1d9defee42412de494de28958d98c0317f7890adb7a90395ea41a079c9e11d
|
7
|
+
data.tar.gz: e6e4f2a83c1d3be863d5bf11857882e06735d00bfa2f56578ae8d600ec711399d8547266919699f4f2c6e22d40a53acdf3a2abbd50a027231e338a84cd06f4c6
|
data/lib/soap4juddi/broker.rb
CHANGED
@@ -16,9 +16,8 @@ module Soap4juddi
|
|
16
16
|
|
17
17
|
def save_element_bindings(service, bindings, urn, description)
|
18
18
|
validate_elements(bindings, 'bindings')
|
19
|
-
body =
|
20
|
-
|
21
|
-
@soap_connector.request_soap(@base_uri, 'publishv2', 'save_binding', body) do | res|
|
19
|
+
body = add_bindings("", service, bindings, urn, description)
|
20
|
+
@soap_connector.request_soap(@base_uri, 'publishv2', 'save_binding', add_auth_body(body)) do | res|
|
22
21
|
res.body
|
23
22
|
end
|
24
23
|
end
|
@@ -29,7 +28,7 @@ module Soap4juddi
|
|
29
28
|
body = build_business_entity(key, name, descriptions, contacts)
|
30
29
|
@soap_connector.request_soap(@base_uri,
|
31
30
|
'publishv2', 'save_business',
|
32
|
-
|
31
|
+
add_auth_body(body)) do | res|
|
33
32
|
extract_business(res.body)
|
34
33
|
end
|
35
34
|
end
|
@@ -50,8 +49,7 @@ module Soap4juddi
|
|
50
49
|
|
51
50
|
def delete_business(key)
|
52
51
|
xml = @soap_xml.element_with_value('businessKey', key)
|
53
|
-
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_business',
|
54
|
-
"#{auth_body} #{xml}") do |res|
|
52
|
+
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_business', add_auth_body(xml)) do |res|
|
55
53
|
{ 'errno' => extract_errno(res.body) }
|
56
54
|
end
|
57
55
|
end
|
@@ -78,7 +76,7 @@ module Soap4juddi
|
|
78
76
|
|
79
77
|
def delete_binding(binding)
|
80
78
|
xml = @soap_xml.element_with_value('bindingKey', binding)
|
81
|
-
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_binding',
|
79
|
+
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_binding', add_auth_body(xml)) do |res|
|
82
80
|
{ 'errno' => extract_errno(res.body) }
|
83
81
|
end
|
84
82
|
end
|
@@ -94,36 +92,15 @@ module Soap4juddi
|
|
94
92
|
end
|
95
93
|
|
96
94
|
def save_service_element(name, description, definition, urn, business_key)
|
97
|
-
# preserve bindings
|
98
95
|
bindings = find_element_bindings_access_points(name, urn)['data']['result']
|
99
|
-
|
100
|
-
service_details = @soap_xml.element_with_value('name', name)
|
101
|
-
if description
|
102
|
-
description.each do |desc|
|
103
|
-
service_details = service_details + @soap_xml.element_with_value('description', desc, { 'xml:lang' => 'en' }) if desc and not (desc == "")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
if definition and not (definition.strip == "")
|
107
|
-
keyedReference = @soap_xml.element_with_value('keyedReference', '', {'tModelKey' => 'uddi:uddi.org:wadl:types', 'keyName' => 'service-definition', 'keyValue' => definition})
|
108
|
-
service_details = service_details + @soap_xml.element_with_value('categoryBag', keyedReference)
|
109
|
-
end
|
110
|
-
xml = @soap_xml.element_with_value('businessService', service_details, {'businessKey' => business_key, 'serviceKey' => "#{urn}#{name}"})
|
111
|
-
|
112
|
-
body = "#{auth_body} #{xml}"
|
113
|
-
|
114
|
-
result = @soap_connector.request_soap(@base_uri, 'publishv2', 'save_service', body) do | res|
|
115
|
-
extract_service(res.body)
|
116
|
-
end
|
117
|
-
|
118
|
-
#restore bindings
|
96
|
+
result = save_service_element_with_side_effect_which_clears_bindings(name, description, definition, urn, business_key)
|
119
97
|
save_element_bindings(name, bindings, urn, '')
|
120
|
-
|
121
98
|
result
|
122
99
|
end
|
123
100
|
|
124
101
|
def delete_service_element(name, urn)
|
125
102
|
service_key = @soap_xml.element_with_value('serviceKey', "#{urn}#{name}")
|
126
|
-
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_service',
|
103
|
+
@soap_connector.request_soap(@base_uri, 'publishv2', 'delete_service', add_auth_body(service_key)) do |res|
|
127
104
|
{ 'errno' => extract_errno(res.body) }
|
128
105
|
end
|
129
106
|
end
|
@@ -144,6 +121,25 @@ module Soap4juddi
|
|
144
121
|
|
145
122
|
private
|
146
123
|
|
124
|
+
def save_service_element_with_side_effect_which_clears_bindings(name, description, definition, urn, business_key)
|
125
|
+
xml = build_service_xml(name, description, definition, urn, business_key)
|
126
|
+
result = @soap_connector.request_soap(@base_uri, 'publishv2', 'save_service', add_auth_body(xml)) do | res|
|
127
|
+
extract_service(res.body)
|
128
|
+
end
|
129
|
+
result
|
130
|
+
end
|
131
|
+
|
132
|
+
def build_service_xml(name, description, definition, urn, business_key)
|
133
|
+
service_details = @soap_xml.element_with_value('name', name)
|
134
|
+
service_details = add_descriptions(service_details, description)
|
135
|
+
service_details = add_definition(service_details, definition)
|
136
|
+
@soap_xml.element_with_value('businessService', service_details, {'businessKey' => business_key, 'serviceKey' => "#{urn}#{name}"})
|
137
|
+
end
|
138
|
+
|
139
|
+
def add_auth_body(body)
|
140
|
+
body = auth_body + body
|
141
|
+
end
|
142
|
+
|
147
143
|
def extract_service_entries_elements(soap, urn)
|
148
144
|
entries = {}
|
149
145
|
entry = soap[/<ns2:serviceInfos>(.*?)<\/ns2:serviceInfos>/, 1]
|
@@ -175,6 +171,14 @@ module Soap4juddi
|
|
175
171
|
end
|
176
172
|
{ 'businesses' => entries }
|
177
173
|
end
|
174
|
+
|
175
|
+
def add_definition(body, definition)
|
176
|
+
if definition and not (definition.strip == "")
|
177
|
+
keyedReference = @soap_xml.element_with_value('keyedReference', '', {'tModelKey' => 'uddi:uddi.org:wadl:types', 'keyName' => 'service-definition', 'keyValue' => definition})
|
178
|
+
return body + @soap_xml.element_with_value('categoryBag', keyedReference)
|
179
|
+
end
|
180
|
+
body
|
181
|
+
end
|
178
182
|
|
179
183
|
def add_descriptions(body, descriptions)
|
180
184
|
if (descriptions) and (not descriptions.empty?)
|
data/lib/soap4juddi/version.rb
CHANGED