Changeset 1853
- Timestamp:
- 06/18/07 22:24:02 (1 year ago)
- Files:
-
- trunk/lib/soap/mapping/literalregistry.rb (modified) (1 diff)
- trunk/lib/soap/mapping/registry.rb (modified) (1 diff)
- trunk/test/wsdl/qualified/test_unqualified.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/mapping/literalregistry.rb
r1835 r1853 71 71 ele = nil 72 72 if obj.is_a?(SOAP::Mapping::Object) 73 ele = mappingobj2soap(obj, qname) 74 elsif definition = schema_definition_from_class(obj.class) 75 # search with class first. obj can be an instance of a subclass of 76 # defined class. 77 ele = stubobj2soap(obj, qname, definition) 78 elsif definition = schema_definition_from_elename(qname) 79 ele = stubobj2soap(obj, qname, definition) 80 else 81 ele = anyobj2soap(obj, qname) 82 end 83 ele 73 return mappingobj2soap(obj, qname) 74 end 75 class_definition = schema_definition_from_class(obj.class) 76 elename_definition = schema_definition_from_elename(qname) 77 if !class_definition and !elename_definition 78 # no definition found 79 return anyobj2soap(obj, qname) 80 end 81 if !class_definition or !elename_definition 82 # use found one 83 return stubobj2soap(obj, qname, class_definition || elename_definition) 84 end 85 # found both: 86 if class_definition.class_for == elename_definition.class_for 87 # if two definitions are for the same class, give qname a priority. 88 return stubobj2soap(obj, qname, elename_definition) 89 end 90 # it should be a derived class 91 return stubobj2soap(obj, qname, class_definition) 84 92 end 85 93 trunk/lib/soap/mapping/registry.rb
r1830 r1853 186 186 obj_class = definition[:class] 187 187 definition = Mapping.create_schema_definition(obj_class, definition) 188 @class_schema_definition[obj_class] = definition 188 # give complexType definition a priority explicitly 189 if !@class_schema_definition[obj_class] or definition.type 190 @class_schema_definition[obj_class] = definition 191 end 189 192 if definition.elename 190 193 @elename_schema_definition[definition.elename] = definition trunk/test/wsdl/qualified/test_unqualified.rb
r1805 r1853 100 100 </env:Envelope>] 101 101 102 LOGIN_REQUEST_QUALIFIED_TYPED =103 %q[<?xml version="1.0" encoding="utf-8" ?>104 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"105 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"106 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">107 <env:Body>108 <n1:login xmlns:n1="urn:lp">109 <username>NaHi</username>110 <password>passwd</password>111 <timezone>JST</timezone>112 </n1:login>113 </env:Body>114 </env:Envelope>]115 116 102 def test_wsdl 117 103 wsdl = File.join(DIR, 'lp.wsdl') … … 139 125 @client.wiredump_dev = str = '' 140 126 @client.login(Login.new('NaHi', 'passwd', 'JST')) 141 assert_equal(LOGIN_REQUEST_QUALIFIED_ TYPED, parse_requestxml(str))127 assert_equal(LOGIN_REQUEST_QUALIFIED_UNTYPED, parse_requestxml(str)) 142 128 end 143 129