| Class | WSDL::SOAP::MappingRegistryCreator |
| In: |
lib/wsdl/soap/mappingRegistryCreator.rb
|
| Parent: | Object |
| definitions | [R] |
# File lib/wsdl/soap/mappingRegistryCreator.rb, line 22
22: def initialize(definitions)
23: @definitions = definitions
24: @complextypes = @definitions.collect_complextypes
25: @types = nil
26: end
# File lib/wsdl/soap/mappingRegistryCreator.rb, line 28
28: def dump(types)
29: @types = types
30: map_cache = []
31: map = ""
32: @types.each do |type|
33: if map_cache.index(type).nil?
34: map_cache << type
35: if type.namespace != XSD::Namespace
36: if typemap = dump_typemap(type)
37: map << typemap
38: end
39: end
40: end
41: end
42: return map
43: end
# File lib/wsdl/soap/mappingRegistryCreator.rb, line 75
75: def dump_array_typemap(definedtype)
76: ele = definedtype.name
77: arytype = definedtype.find_arytype || XSD::AnyTypeName
78: type = XSD::QName.new(arytype.namespace, arytype.name.sub(/\[(?:,)*\]$/, ''))
79: @types << type
80: return "MappingRegistry.set(\n \#{create_class_name(ele)},\n ::SOAP::SOAPArray,\n ::SOAP::Mapping::Registry::TypedArrayFactory,\n { :type => \#{dqname(type)} }\n)\n"
81: end
# File lib/wsdl/soap/mappingRegistryCreator.rb, line 62
62: def dump_struct_typemap(definedtype)
63: ele = definedtype.name
64: return "MappingRegistry.set(\n \#{create_class_name(ele)},\n ::SOAP::SOAPStruct,\n ::SOAP::Mapping::Registry::TypedStructFactory,\n { :type => \#{dqname(ele)} }\n)\n"
65: end
# File lib/wsdl/soap/mappingRegistryCreator.rb, line 47
47: def dump_typemap(type)
48: if definedtype = @complextypes[type]
49: case definedtype.compoundtype
50: when :TYPE_STRUCT
51: dump_struct_typemap(definedtype)
52: when :TYPE_ARRAY
53: dump_array_typemap(definedtype)
54: when :TYPE_MAP, :TYPE_EMPTY
55: nil
56: else
57: raise NotImplementedError.new("must not reach here")
58: end
59: end
60: end