Changeset 1897
- Timestamp:
- 07/21/07 13:36:04 (1 year ago)
- Files:
-
- trunk/lib/soap/mapping/literalregistry.rb (modified) (1 diff)
- trunk/test/wsdl/choice/choice.wsdl (modified) (5 diffs)
- trunk/test/wsdl/choice/test_choice.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/mapping/literalregistry.rb
r1871 r1897 175 175 else 176 176 if child.respond_to?(:each) and definition.as_array? 177 child.each do |item| 178 ele.add(definedobj2soap(item, definition)) 177 if child.empty? 178 added = false 179 else 180 child.each do |item| 181 ele.add(definedobj2soap(item, definition)) 182 end 179 183 end 180 184 else trunk/test/wsdl/choice/choice.wsdl
r1790 r1897 27 27 <xsd:element name="C2" type="xsd:string"/> 28 28 </xsd:sequence> 29 </xsd:sequence> 30 </xsd:complexType> 31 32 <xsd:complexType name="emptyArrayAtFirst"> 33 <xsd:sequence> 34 <xsd:choice> 35 <xsd:element name="A" maxOccurs="unbounded" type="xsd:string"/> 36 <xsd:element name="B1" type="xsd:string"/> 37 <xsd:element name="B2" type="xsd:string"/> 38 </xsd:choice> 29 39 </xsd:sequence> 30 40 </xsd:complexType> … … 70 80 </xsd:complexType> 71 81 </xsd:element> 82 83 <xsd:element name="echoele_complex_emptyArrayAtFirst"> 84 <xsd:complexType> 85 <xsd:sequence> 86 <xsd:element name="data" type="tns:emptyArrayAtFirst"/> 87 </xsd:sequence> 88 </xsd:complexType> 89 </xsd:element> 72 90 </xsd:schema> 73 91 </types> … … 85 103 <part name="parameters" element="tns:echo_complex_response" /> 86 104 </message> 105 <message name="echo_complex_emptyArrayAtFirst_in"> 106 <part name="parameters" element="tns:echoele_complex_emptyArrayAtFirst" /> 107 </message> 108 <message name="echo_complex_emptyArrayAtFirst_out"> 109 <part name="parameters" element="tns:echoele_complex_emptyArrayAtFirst" /> 110 </message> 87 111 88 112 <portType name="choice_porttype"> … … 95 119 <input message="tns:echo_complex_in" /> 96 120 <output message="tns:echo_complex_out" /> 121 </operation> 122 123 <operation name="echo_complex_emptyArrayAtFirst"> 124 <input message="tns:echo_complex_emptyArrayAtFirst_in" /> 125 <output message="tns:echo_complex_emptyArrayAtFirst_out" /> 97 126 </operation> 98 127 </portType> … … 119 148 </output> 120 149 </operation> 150 151 <operation name="echo_complex_emptyArrayAtFirst"> 152 <soap:operation soapAction="urn:choice:echo_complex_emptyArrayAtFirst" style="document" /> 153 <input> 154 <soap:body use="literal" /> 155 </input> 156 <output> 157 <soap:body use="literal" /> 158 </output> 159 </operation> 121 160 </binding> 122 161 trunk/test/wsdl/choice/test_choice.rb
r1794 r1897 29 29 XSD::QName.new(Namespace, 'echo_complex_response') 30 30 ) 31 add_document_method( 32 self, 33 Namespace + ':echo_complex_emptyArrayAtFirst', 34 'echo_complex_emptyArrayAtFirst', 35 XSD::QName.new(Namespace, 'echoele_complex_emptyArrayAtFirst'), 36 XSD::QName.new(Namespace, 'echoele_complex_emptyArrayAtFirst') 37 ) 31 38 @router.literal_mapping_registry = ChoiceMappingRegistry::LiteralRegistry 32 39 end … … 38 45 def echo_complex(arg) 39 46 Echo_complex_response.new(arg.data) 47 end 48 49 def echo_complex_emptyArrayAtFirst(arg) 50 arg 40 51 end 41 52 end … … 78 89 gen.opt['force'] = true 79 90 gen.run 80 TestUtil.require(DIR, 'choice MappingRegistry.rb', 'choice.rb')91 TestUtil.require(DIR, 'choiceDriver.rb', 'choiceMappingRegistry.rb', 'choice.rb') 81 92 end 82 93 … … 178 189 assert_equal("C2", ret.data.c2) 179 190 end 191 192 def test_stub_emptyArrayAtFirst 193 @client = Choice_porttype.new("http://localhost:#{Port}/") 194 @client.wiredump_dev = STDOUT if $DEBUG 195 # 196 arg = EmptyArrayAtFirst.new 197 arg.b1 = "b1" 198 ret = @client.echo_complex_emptyArrayAtFirst(arg) 199 assert_nil(ret.a) 200 assert_equal("b1", ret.b1) 201 assert_nil(ret.b2) 202 end 180 203 end 181 204