Class: Genio::Parser::Format::Wsdl
- Defined in:
- lib/genio/parser/format/wsdl.rb
Instance Attribute Summary
Attributes inherited from Wadl
#attributes, #current_schema, #element_form_defaults, #namespaces
Attributes inherited from Base
#data_types, #endpoint, #enum_types, #files, #options, #services
Instance Method Summary collapse
- #operation_property(type) ⇒ Object
- #parse_schema(schema) ⇒ Object
- #parse_service(service) ⇒ Object
- #xslt ⇒ Object
Methods inherited from Wadl
#add_operation, #get_element, #load, #load_doc, #parse_data_type, #parse_property, #parse_resource
Methods inherited from Base
#expand_path, #initialize, #load_files, #open, #read_file, #to_iodocs
Methods included from Logging
Constructor Details
This class inherits a constructor from Genio::Parser::Format::Base
Instance Method Details
#operation_property(type) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/genio/parser/format/wsdl.rb', line 77 def operation_property(type) property = Types::Property.new(type.attributes.map{|k,v| [k, v.value] }) property.type = valid_type(property.type) element = current_schema.css("elements element[name=#{property.type}]").first property.type = valid_type(element.attr("type")) if element and element.attr("type").present? property end |
#parse_schema(schema) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/genio/parser/format/wsdl.rb', line 25 def parse_schema(schema) super schema.css("services service").each do |service| parse_service(service) end end |
#parse_service(service) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/genio/parser/format/wsdl.rb', line 33 def parse_service(service) name = service.attr("name") self.services[name] ||= Types::Service.new( :operations => {} ) service_binding = service.css("binding").first if service_binding type = service_binding.attr("type") self.services[name].package = self.namespaces.find{|k,v| v == type }.try(:first) || type end service.css("functions function").each do |func| = Hash[func.attributes.map{|k,v| [k, v.value] }] operation = Types::Operation.new(.merge(:path => "/", :type => "POST")) request = func.css("parameters variable[part=body]").first if request operation.request_property = operation_property(request) operation.request = operation.request_property.type end header = func.css("parameters variable[part=header]").first if header operation.header_property = operation_property(header) operation.header = operation.header_property.type end response = func.css("returns variable[part=body]").first if response operation.response_property = operation_property(response) operation.response = operation.response_property.type end fault = func.css("throws variable").first if fault operation.fault_property = operation_property(fault) operation.fault = operation.fault_property.type self.data_types[operation.fault].fault = true if self.data_types[operation.fault] end self.services[name].operations[func.attr("name")] = operation end end |
#xslt ⇒ Object
21 22 23 |
# File 'lib/genio/parser/format/wsdl.rb', line 21 def xslt @xslt ||= Nokogiri::XSLT(File.read(File.("../../../../../data/wsdl2meta.xsl", __FILE__))) end |