uddi4r 0.7

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.
Files changed (48) hide show
  1. data/README +19 -0
  2. data/doc/classes/Uddi4r/BindingDetail.html +120 -0
  3. data/doc/classes/Uddi4r/BindingTemplate.html +120 -0
  4. data/doc/classes/Uddi4r/BusinessDetail.html +120 -0
  5. data/doc/classes/Uddi4r/BusinessEntity.html +120 -0
  6. data/doc/classes/Uddi4r/BusinessInfo.html +120 -0
  7. data/doc/classes/Uddi4r/BusinessList.html +120 -0
  8. data/doc/classes/Uddi4r/BusinessService.html +120 -0
  9. data/doc/classes/Uddi4r/CategoryBag.html +120 -0
  10. data/doc/classes/Uddi4r/Client.html +651 -0
  11. data/doc/classes/Uddi4r/Connection.html +331 -0
  12. data/doc/classes/Uddi4r/DiscoveryURLs.html +157 -0
  13. data/doc/classes/Uddi4r/FindQualifiers.html +157 -0
  14. data/doc/classes/Uddi4r/IdentifierBag.html +120 -0
  15. data/doc/classes/Uddi4r/KeyedReference.html +120 -0
  16. data/doc/classes/Uddi4r/Model.html +296 -0
  17. data/doc/classes/Uddi4r/OverviewDoc.html +120 -0
  18. data/doc/classes/Uddi4r/RelatedBusinessesList.html +120 -0
  19. data/doc/classes/Uddi4r/ServiceDetail.html +120 -0
  20. data/doc/classes/Uddi4r/ServiceInfo.html +120 -0
  21. data/doc/classes/Uddi4r/ServiceList.html +120 -0
  22. data/doc/classes/Uddi4r/SoapBuilder.html +356 -0
  23. data/doc/classes/Uddi4r/TModel.html +120 -0
  24. data/doc/classes/Uddi4r/TModelBag.html +155 -0
  25. data/doc/classes/Uddi4r/TModelDetail.html +120 -0
  26. data/doc/classes/Uddi4r/TModelInstanceInfo.html +120 -0
  27. data/doc/classes/Uddi4r.html +154 -0
  28. data/doc/created.rid +1 -0
  29. data/doc/files/README.html +147 -0
  30. data/doc/files/lib/client_rb.html +117 -0
  31. data/doc/files/lib/connection_rb.html +119 -0
  32. data/doc/files/lib/models_rb.html +115 -0
  33. data/doc/files/lib/soap_builder_rb.html +108 -0
  34. data/doc/fr_class_index.html +52 -0
  35. data/doc/fr_file_index.html +31 -0
  36. data/doc/fr_method_index.html +54 -0
  37. data/doc/index.html +24 -0
  38. data/doc/rdoc-style.css +208 -0
  39. data/lib/client.rb +203 -0
  40. data/lib/connection.rb +74 -0
  41. data/lib/models.rb +207 -0
  42. data/lib/soap_builder.rb +89 -0
  43. data/test/fixtures/business_service.xml +40 -0
  44. data/test/fixtures/test_uddi_servers.rb +31 -0
  45. data/test/test_client.rb +141 -0
  46. data/test/test_connection.rb +34 -0
  47. data/test/test_model.rb +34 -0
  48. metadata +97 -0
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
data/lib/client.rb ADDED
@@ -0,0 +1,203 @@
1
+ # uddi4r - UDDI Client for Ruby
2
+ # http://rubyforge.org/projects/uddi4r/
3
+ require "rexml/element"
4
+ require "lib/connection"
5
+ require "lib/models"
6
+
7
+ module Uddi4r
8
+ # = Uddi4r::Client
9
+ #
10
+ # This is the main class for UDDI inquiry services. It supports all the
11
+ # UDDI inquiry operations specified in UDDI Programmers API V2. For details
12
+ # about the UDDI V2 Specification, visit:
13
+ #
14
+ # http://uddi.org/pubs/ProgrammersAPI-V2.04-Published-20020719.htm
15
+ #
16
+ # == Using the client
17
+ # You can construct the client with a URL string to the UDDI server or a Uddi4r::Connection object.
18
+ # You can then invoke all UDDI inquiry operations by calling the appropriate API methods and passing a hash of arguments.
19
+ #
20
+ # For example, the following code queires the Microsoft Test UDDI for businesses that
21
+ # have "Microsoft" as part of their names:
22
+ #
23
+ # client = Uddi4r::Client.new("http://test.uddi.microsoft.com/inquire")
24
+ # businesses = client.find_business(:name=>"Microsoft")
25
+ #
26
+ # === Simple and advanced arguments
27
+ # There are two type of arguments that you can pass, simple and advanced. Simple
28
+ # arguments are either String or Array of String, as in the example above. These
29
+ # types of arguments will give you the commonly used inquiry capabilities.
30
+ #
31
+ # Advanced arguments are Uddi4r::Model objects that provide advanced
32
+ # capabilities such as findQualifiers, tModelBags, categoryBags, etc. See the
33
+ # specficiation for details.
34
+ #
35
+ # Following example uses a _findQualifer_ to do a case-sensitivity to the
36
+ # previous example:
37
+ #
38
+ # businesses = client.find_business(:name=>"Microsoft",
39
+ # find_qualifers=>Uddi4r::FindQualifers("caseSensitiveMatch")
40
+ # === Return types
41
+ # All client API methods return Uddi4r::Model objects.
42
+ #
43
+ # === Not supported
44
+ # The get_businessDetailExt operation is not supported in this release.
45
+ #
46
+ class Client
47
+ # Create a UDDI inquiry object for invoking inquiry operations.
48
+ #
49
+ # connection:: String with endpoint or Uddi4r::Connection
50
+ # debug:: Boolean for showing low-level wire communication.
51
+ def initialize(connection, debug=false)
52
+ @conn = (connection.is_a? Connection) ? connection :
53
+ Connection.new(connection, "2.0", debug)
54
+ end
55
+
56
+ # Find binding detail for a given service and tModels.
57
+ # [Returns] Uddi4r::BindingDetail
58
+ # ==== Simple arguments
59
+ # service_key:: String for service. (required)
60
+ # ==== Advanced arguments
61
+ # find_qualifiers:: Uddi4r::FindQualifiers
62
+ # t_model_bag:: Uddi4r::TModelBag (required)
63
+ # ==== Example
64
+ # binding_detil = client.find_binding(:service_key=>"7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED",
65
+ # :t_model_bag=>Uddi4r::TModelBag.new("uuid:928A64AB-E277-32FA-0ABA-A28CE9E5E6A5"))
66
+ def find_binding(args)
67
+ service_key = required(args, :service_key, String)
68
+ args[:t_model_bag] = TModelBag.new(args[:t_model_keys]) if args[:t_model_keys]
69
+ operation = @conn.create_operation("find_binding",
70
+ {"serviceKey"=>required(args, :service_key, String)},
71
+ args[:find_qualifier], "tModelBag"=>required(args, :t_model_bag, TModelBag)
72
+ );
73
+ BindingDetail.create_from(@conn.invoke_operation(operation))
74
+ end
75
+
76
+ # Find businesses matching a given name.
77
+ # [Returns] Uddi4r::BusinessList
78
+ # ==== Simple arguments
79
+ # name:: String for full or partial name
80
+ # ==== Advanced arguments
81
+ # find_qualifiers:: Uddi4r::FindQualifiers
82
+ # identifier_bag:: Uddi4r::IdentifierBag
83
+ # category_bag:: Uddi4r::CategoryBag
84
+ # t_model_bag:: Uddi4r::TModelBag
85
+ # discovery_urls:: Uddi4r::DiscoveryURLs
86
+ # ==== Examples
87
+ # businesses = client.find_business(:name=>"Microsoft")
88
+ #
89
+ # businesses = client.find_business(:name=>"Microsoft",
90
+ # FindQualifiers.new("exactMatch"))
91
+ def find_business(args={})
92
+ operation = @conn.create_operation("find_business", {},
93
+ args[:find_qualifiers], {"name"=>args[:name]},
94
+ args[:identifier_bag], args[:category_bag],
95
+ args[:t_model_bag],args[:discovery_urls])
96
+ BusinessList.create_from(@conn.invoke_operation(operation))
97
+ end
98
+
99
+ # Find businesses related to a given business.
100
+ # [Returns] Uddi4r::RelatedBusinessesList.
101
+ # ==== Simple arguments
102
+ # business_key:: String for business key (required)
103
+ # ==== Advanced arguments
104
+ # find_qualifiers:: Uddi4r::FindQualifiers
105
+ # ==== Example
106
+ # related_bizs = client.find_related_business(:business_key=>"7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED")
107
+ def find_related_businesses(args={})
108
+ operation = @conn.create_operation("find_relatedBusinesses", {},
109
+ args[:find_qualifiers],
110
+ {"businessKey"=>required(args, :business_key, String)})
111
+ RelatedBusinessesList.create_from(@conn.invoke_operation(operation))
112
+ end
113
+
114
+ # Find services for given business key or name.
115
+ # [Returns] Uddi4r::ServiceList
116
+ # ==== Simple arguments
117
+ # business_key:: String for business key
118
+ # names:: Array of service name String, or
119
+ # name:: String for service name
120
+ # ==== Advanced arguments
121
+ # find_qualifiers:: Uddi4r::FindQualifiers
122
+ # t_model_bag:: Uddi4r::TModelBag
123
+ # ==== Example
124
+ # services = client.find_service(:name=>"Currency Conversion")
125
+ def find_service(args={})
126
+ # create array if only one given
127
+ names = args[:name] ? [ args[:name] ] : args[:names]
128
+ operation = @conn.create_operation("find_service",
129
+ {:business_key=>args[:business_key]},
130
+ @conn.create_elements("name", *names),
131
+ args[:t_model_bag])
132
+ ServiceList.create_from(@conn.invoke_operation(operation))
133
+ end
134
+
135
+ # Get binding detail for given binding key.
136
+ # [Returns] Uddi4r::BindingDetail
137
+ # ==== Simple arguments
138
+ # binding_keys:: Array of binding key String, or
139
+ # binding_key:: String for binding key
140
+ # ==== Example
141
+ # bd = client.get_binding(:binding_key=>"C7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED")
142
+ # url = bd.binding_template.first.access_point()
143
+ def get_binding_detail(args)
144
+ # create array if only one given
145
+ args[:binding_keys] = [args[:binding_key]] if args[:binding_key]
146
+ operation = @conn.create_operation("get_bindingDetail", {},
147
+ @conn.create_elements("bindingKey", *required(args, :binding_keys, Array) )
148
+ )
149
+ BindingDetail.create_from(@conn.invoke_operation(operation))
150
+ end
151
+
152
+ # Get business detail for given business key.
153
+ # [Returns] Uddi4r::BusinessDetail
154
+ # ==== Simple arguments
155
+ # business_keys:: Array of business key String, or
156
+ # business_key:: String for business key
157
+ # ==== Example
158
+ # biz = client.get_business_detail(:business_keys=>["C7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED", "..."])
159
+ def get_business_detail(args)
160
+ args[:business_keys] = [args[:business_key]] if args[:business_key]
161
+ operation = @conn.create_operation("get_businessDetail", {},
162
+ @conn.create_elements("businessKey", *required(args, :business_keys, Array)))
163
+ BusinessDetail.create_from(@conn.invoke_operation(operation))
164
+ end
165
+
166
+ # Get tModel detail for given tModel key or keys.
167
+ # [Returns] Uddi4r::TModelDetail
168
+ # ==== Simple arguments
169
+ # t_model_keys:: Array of tModel key String, or
170
+ # t_model_key:: String for tModel key
171
+ # ==== Example
172
+ # t_models = client.get_t_model_detail(:t_model_keys=>["C7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED", "..."])
173
+ def get_t_model_detail(args)
174
+ args[:t_model_keys] = [args[:t_model_key]] if args[:t_model_key]
175
+ operation = @conn.create_operation("get_tModelDetail", {},
176
+ @conn.create_elements("tModelKey", *required(args, :t_model_keys, Array)))
177
+ TModelDetail.create_from(@conn.invoke_operation(operation))
178
+ end
179
+
180
+ # Get service detail for given service key or keys.
181
+ # [Returns] Uddi4r::ServiceDetail
182
+ # ==== Simple arguments
183
+ # service_keys:: Array of service key String, or
184
+ # service_key:: String for service key
185
+ # ==== Example
186
+ # service_details = client.get_service_detail(:service_keys=>["C7CEAB5C2-D40E-1E0C-7942-99C64EF3C1ED", "..."])
187
+ def get_service_detail(args)
188
+ args[:service_keys] = [args[:service_key]] if args[:service_key]
189
+ operation = @conn.create_operation("get_serviceDetail", {},
190
+ @conn.create_elements("serviceKey", *required(args, :service_keys, Array)))
191
+ ServiceDetail.create_from(@conn.invoke_operation(operation))
192
+ end
193
+
194
+ private
195
+ # Check for existance and type of key in argument hash
196
+ # [Returns] The value in arg hash
197
+ def required(arg, symbol, type)
198
+ raise "#{type} #{symbol.to_s} is required" unless arg[symbol] and arg[symbol].is_a? type
199
+ raise "#{type} #{symbol.to_s} is wrong type (#{arg[symbol].type})" unless arg[symbol].is_a? type
200
+ return arg[symbol]
201
+ end
202
+ end
203
+ end
data/lib/connection.rb ADDED
@@ -0,0 +1,74 @@
1
+ # = Uddi4r UDDI for Ruby
2
+ # http://uddi4r.rubyforge.org
3
+
4
+ require "soap/streamHandler"
5
+ require "soap/processor"
6
+ require "rexml/document"
7
+ require "rexml/element"
8
+ require "lib/soap_builder"
9
+
10
+ module Uddi4r
11
+ # = Connection
12
+ #
13
+ # This class manages the UDDI connection and SOAP messaging.
14
+ # It also provides helper methods for creating SOAP payload
15
+ # and related XML elements.
16
+ #
17
+ # == Example
18
+ #
19
+ # Following example demonstrates the typical browse use-case
20
+ # for UDDI. It starts with the findBusiness use-case and drills
21
+ # down to the specific binding.
22
+ #
23
+ # uddi = Uddi4r::UddiClient.new(XMethodsUddi.url)
24
+ # biz = uddi.find_business("chaiwat").first
25
+ # service = biz.service_infos.first
26
+ # binding = uddi.find_binding(service.service_key)
27
+ class Connection
28
+ include SoapBuilder
29
+ @@XmlNamespace = {"2.0"=>"urn:uddi-org:api_v2"}
30
+
31
+ # Create the UDDI connection for given endpoint and protocol version.
32
+ # endpoint:: URL to UDDI server as string
33
+ # version:: UDDI protocol version as string. Default (and only support) is "2.0"
34
+ def initialize(endpoint, version="2.0", debug=false)
35
+ @endpoint = endpoint
36
+ @version = version.to_s()
37
+ @uddi_namespace = Connection.namespace_for(@version)
38
+ props = SOAP::Property.new()
39
+ props["wiredump_dev"] = STDOUT if debug
40
+ @stream_handler = SOAP::HTTPStreamHandler.new(props)
41
+ @max_rows = nil
42
+ end
43
+
44
+ # Returns fully qualified namespace for given UDDI protocol version
45
+ def self.namespace_for(version)
46
+ return @@XmlNamespace[version.to_s()] || raise("Unsupported UDDI version #{version}")
47
+ end
48
+
49
+ # Set the maximum rows returns by the UDDI server
50
+ def max_rows=(max_rows)
51
+ @max_rows = max_rows
52
+ end
53
+
54
+ # Uses the connection to invoke SOAP call for given operation (DOM element)
55
+ def invoke_operation(operation)
56
+ body = create_body()
57
+ body << operation
58
+ payload = create_payload(body)
59
+ invoke(payload)
60
+ end
61
+
62
+ # Uses the connection to transmit given payload (DOM element)
63
+ def invoke(payload)
64
+ return puts(payload) unless @endpoint
65
+ data = SOAP::StreamHandler::ConnectionData.new(payload.to_s())
66
+ response = @stream_handler.send(@endpoint, data).receive_string
67
+ return REXML::Document.new(response)
68
+ end
69
+
70
+ def to_s
71
+ "UDDI connection: #{@endpoint}: #{@version} ns:#{@uddi_namespace}"
72
+ end
73
+ end
74
+ end
data/lib/models.rb ADDED
@@ -0,0 +1,207 @@
1
+ # uddi4r - UDDI Client for Ruby
2
+ # http://rubyforge.org/projects/uddi4r/
3
+
4
+ require "rubygems"
5
+ require_gem "roxml"
6
+
7
+ module Uddi4r
8
+ # UDDI models are first-class Ruby objects that represent UDDI data structures.
9
+ # For more information about UDDI data structures, see:
10
+ # http://uddi.org/pubs/DataStructure-V2.03-Published-20020719.htm
11
+ #
12
+ # These objects are used as arguments and return types for methods in Uddi4r::Client.
13
+ #
14
+ # The following model objects are available:
15
+ # * ServiceInfo
16
+ # * BusinessInfo
17
+ # * BusinessList
18
+ # * ServiceList
19
+ # * TModelInstanceInfo
20
+ # * BindingTemplate
21
+ # * BindingDetail
22
+ # * RelatedBusinessesList
23
+ # * BusinessService
24
+ # * BusinessEntity
25
+ # * BusinessDetail
26
+ # * KeyedReference
27
+ # * OverviewDoc
28
+ # * CategoryBag
29
+ # * TModel
30
+ # * TModelBag
31
+ # * TModelDetail
32
+ # * ServiceDetail
33
+ # * IdentifierBag
34
+ # * DiscoveryURLs
35
+ # * FindQualifiers
36
+ #
37
+ class Model
38
+ include ROXML
39
+
40
+ # Define the default name to be first letter lower-case (UDDI naming convention)
41
+ # So, for example, ServiceInfo becomes serviceInfo
42
+ def self.tag_name
43
+ @tag_name || self.name.to_s.gsub(/.*::/,"").gsub(/^(.)/) { $1.downcase }
44
+ end
45
+
46
+ # Create a UDDI model object from REXML::Element using ROXML.parse(). Handles nil.
47
+ def self.create_from(response)
48
+ return nil unless response
49
+ element = response.elements["*/*/#{self.tag_name()}"]
50
+ return nil unless element
51
+ self.parse(element)
52
+ end
53
+
54
+ # Yield self if a block is passed.
55
+ def initialize()
56
+ yield self if block_given?
57
+ end
58
+
59
+ end
60
+
61
+ # UDDI ServiceInfo, for more information, see Uddi4r::Model.
62
+ class ServiceInfo < Model
63
+ xml_text :name, "name"
64
+ xml_attribute :service_key, "serviceKey"
65
+ end
66
+
67
+ # UDDI BusinessInfo, for more information, see Uddi4r::Model.
68
+ class BusinessInfo < Model
69
+ xml_text :name, "name"
70
+ xml_attribute :business_key, "businessKey"
71
+ xml_object :service_infos, ServiceInfo, ROXML::TAG_ARRAY, "serviceInfos"
72
+ end
73
+
74
+ # UDDI BusinessList, for more information, see Uddi4r::Model.
75
+ class BusinessList < Model
76
+ xml_attribute :operator
77
+ xml_object :business_infos, Uddi4r::BusinessInfo, ROXML::TAG_ARRAY, "businessInfos"
78
+ end
79
+
80
+ # UDDI ServiceList, for more information, see Uddi4r::Model.
81
+ class ServiceList < Model
82
+ xml_attribute :operator
83
+ xml_object :service_infos, ServiceInfo, ROXML::TAG_ARRAY, "serviceInfos"
84
+ end
85
+
86
+ # UDDI TModelInstanceInfo, for more information, see Uddi4r::Model.
87
+ class TModelInstanceInfo < Model
88
+ xml_attribute :t_model_key, "tModelKey"
89
+ end
90
+
91
+ # UDDI bindingTemplate, for more information, see Uddi4r::Model.
92
+ class BindingTemplate < Model
93
+ xml_attribute :binding_key, "bindingKey"
94
+ xml_attribute :service_key, "serviceKey"
95
+ xml_text :description
96
+ xml_text :access_point, "accessPoint"
97
+ xml_object :t_model_instance_details, Uddi4r::TModelInstanceInfo, ROXML::TAG_ARRAY, "tModelInstanceDetails"
98
+ end
99
+
100
+ # UDDI bindingDetail, for more information, see Uddi4r::Model.
101
+ class BindingDetail < Model
102
+ xml_attribute :operator
103
+ xml_object :binding_template, Uddi4r::BindingTemplate, ROXML::TAG_ARRAY
104
+ end
105
+
106
+ # UDDI relatedBusinessesList, for more information, see Uddi4r::Model.
107
+ class RelatedBusinessesList < Model
108
+ xml_text :business_key, "businessKey"
109
+ xml_object :business_infos, Uddi4r::BusinessInfo, ROXML::TAG_ARRAY, "relatedBusinessInfos"
110
+ end
111
+
112
+ # UDDI businessService, for more information, see Uddi4r::Model.
113
+ class BusinessService < Model
114
+ xml_text :name
115
+ xml_text :description, nil, ROXML::TAG_ARRAY
116
+ xml_object :binding_templates, Uddi4r::BindingTemplate, ROXML::TAG_ARRAY, "bindingTemplates"
117
+ end
118
+
119
+ # UDDI businessEntity, for more information, see Uddi4r::Model.
120
+ class BusinessEntity < Model
121
+ xml_text :name
122
+ xml_text :discovery_url, "discoveryURL", ROXML::TAG_ARRAY, "discoveryURLs"
123
+ xml_object :business_services, Uddi4r::BusinessService, ROXML::TAG_ARRAY, "businessServices"
124
+ end
125
+
126
+ # UDDI businessDetail, for more information, see Uddi4r::Model.
127
+ class BusinessDetail < Model
128
+ xml_object :business_entity, Uddi4r::BusinessEntity, ROXML::TAG_ARRAY
129
+ end
130
+
131
+
132
+ # UDDI keyedReference, for more information, see Uddi4r::Model.
133
+ class KeyedReference < Model
134
+ xml_attribute :key_name, "keyName"
135
+ xml_attribute :key_value, "keyValue"
136
+ xml_attribute :t_model_key, "tModelKey"
137
+ end
138
+
139
+ # UDDI overviewBag, for more information, see Uddi4r::Model.
140
+ class OverviewDoc < Model
141
+ xml_text :description
142
+ xml_text :overview_url, "overviewURL"
143
+ end
144
+
145
+ # UDDI categoryBag, for more information, see Uddi4r::Model.
146
+ class CategoryBag < Model
147
+ xml_object :keyed_reference, Uddi4r::KeyedReference, ROXML::TAG_ARRAY
148
+ end
149
+
150
+ # UDDI tModel, for more information, see Uddi4r::Model.
151
+ class TModel < Model
152
+ xml_attribute :t_model_key, "tModelKey"
153
+ xml_attribute :operator
154
+ xml_text :name
155
+ xml_text :description
156
+ xml_object :overview_doc, Uddi4r::OverviewDoc
157
+ xml_object :category_bag, Uddi4r::CategoryBag
158
+ end
159
+
160
+ # UDDI tModelBag, for more information, see Uddi4r::Model.
161
+ class TModelBag < Model
162
+ xml_text :t_model_key, nil, ROXML::TAG_ARRAY
163
+
164
+ def initialize(t_model_keys=nil)
165
+ t_model_key = t_model_keys
166
+ end
167
+ end
168
+
169
+ # UDDI tModelDetail, for more information, see Uddi4r::Model.
170
+ class TModelDetail < Model
171
+ xml_object :t_model, Uddi4r::TModel, ROXML::TAG_ARRAY
172
+ end
173
+
174
+ # UDDI serviceDetail, for more information, see Uddi4r::Model.
175
+ class ServiceDetail < Model
176
+ xml_attribute :operator
177
+ xml_object :business_service, Uddi4r::BusinessService, ROXML::TAG_ARRAY
178
+ end
179
+
180
+ # UDDI identifierBag, for more information, see Uddi4r::Model.
181
+ class IdentifierBag < Model
182
+ xml_object :keyed_reference, Uddi4r::KeyedReference, ROXML::TAG_ARRAY
183
+ end
184
+
185
+ # UDDI discoverURLs, for more information, see Uddi4r::Model.
186
+ class DiscoveryURLs < Model
187
+ xml_text :discovery_url, nil, ROXML::TAG_ARRAY
188
+
189
+ def initialize(*urls)
190
+ urls.each do |u|
191
+ discovery_url << u
192
+ end
193
+ end
194
+ end
195
+
196
+ # UDDI findQualifiers, for more information, see Uddi4r::Model.
197
+ class FindQualifiers < Model
198
+ xml_text :find_qualifier, nil, ROXML::TAG_ARRAY
199
+
200
+ def initialize(*qualifiers)
201
+ qualifiers.each do |q|
202
+ find_qualifier << q
203
+ end
204
+ end
205
+ end
206
+
207
+ end