# File lib/wsdl/soap/driverCreator.rb, line 26 26: def initialize(definitions, name_creator, modulepath = nil) 27: @definitions = definitions 28: @name_creator = name_creator 29: @modulepath = modulepath 30: @drivername_postfix = '' 31: end
# File lib/wsdl/soap/driverCreator.rb, line 33 33: def dump(porttype = nil) 34: result = "require 'soap/rpc/driver'\n\n" 35: if @modulepath 36: @modulepath.each do |name| 37: result << "module #{name}\n" 38: end 39: result << "\n" 40: end 41: if porttype.nil? 42: @definitions.porttypes.each do |type| 43: result << dump_porttype(type.name) 44: result << "\n" 45: end 46: else 47: result << dump_porttype(porttype) 48: end 49: if @modulepath 50: result << "\n" 51: @modulepath.each do |name| 52: result << "end\n" 53: end 54: end 55: result 56: end
# File lib/wsdl/soap/driverCreator.rb, line 60 60: def dump_porttype(porttype) 61: drivername = porttype.name + @drivername_postfix 62: qname = XSD::QName.new(porttype.namespace, drivername) 63: class_name = mapped_class_basename(qname, @modulepath) 64: defined_const = {} 65: result = MethodDefCreator.new(@definitions, @name_creator, @modulepath, defined_const).dump(porttype) 66: methoddef = result[:methoddef] 67: binding = @definitions.bindings.find { |item| item.type == porttype } 68: if binding.nil? or binding.soapbinding.nil? 69: # not bind or not a SOAP binding 70: return '' 71: end 72: address = @definitions.porttype(porttype).locations[0] 73: 74: c = XSD::CodeGen::ClassDef.new(class_name, "::SOAP::RPC::Driver") 75: c.def_const("DefaultEndpointUrl", ndq(address)) 76: c.def_code Methods = [#{methoddef.gsub(/^/, " ")}] 77: wsdl_name = @definitions.name ? @definitions.name.name : 'default' 78: mrname = safeconstname(wsdl_name + 'MappingRegistry') 79: c.def_method("initialize", "endpoint_url = nil") do 80: %[endpoint_url ||= DefaultEndpointUrl\n] + 81: %[super(endpoint_url, nil)\n] + 82: %[self.mapping_registry = #{mrname}::EncodedRegistry\n] + 83: %[self.literal_mapping_registry = #{mrname}::LiteralRegistry\n] + 84: %[init_methods] 85: end 86: c.def_privatemethod("init_methods") do 87: Methods.each do |definitions| opt = definitions.last if opt[:request_style] == :document add_document_operation(*definitions) else add_rpc_operation(*definitions) qname = definitions[0] name = definitions[2] if qname.name != name and qname.name.capitalize == name.capitalize ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg| __send__(name, *arg) end end end end 88: end 89: defined_const.each do |ns, tag| 90: c.def_const(tag, dq(ns)) 91: end 92: c.dump 93: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.