Changeset 1584
- Timestamp:
- 07/21/05 22:38:35 (3 years ago)
- Files:
-
- trunk/lib/soap/encodingstyle/literalHandler.rb (modified) (1 diff)
- trunk/lib/soap/mapping/mapping.rb (modified) (2 diffs)
- trunk/lib/soap/mapping/wsdlliteralregistry.rb (modified) (1 diff)
- trunk/lib/soap/rpc/router.rb (modified) (1 diff)
- trunk/lib/wsdl/soap/classDefCreator.rb (modified) (1 diff)
- trunk/lib/wsdl/xmlSchema/element.rb (modified) (4 diffs)
- trunk/test/soap/test_httpconfigloader.rb (modified) (2 diffs)
- trunk/test/wsdl/any/expectedEcho.rb (modified) (1 diff)
- trunk/test/wsdl/document/echo.rb (modified) (3 diffs)
- trunk/test/wsdl/marshal/person_org.rb (modified) (1 diff)
- trunk/test/wsdl/qualified/lp.wsdl (modified) (3 diffs)
- trunk/test/wsdl/qualified/lp.xsd (modified) (1 diff)
- trunk/test/wsdl/qualified/test_qualified.rb (modified) (4 diffs)
- trunk/test/wsdl/ref/expectedProduct.rb (modified) (2 diffs)
- trunk/test/wsdl/rpc/test-rpc-lit.wsdl (modified) (4 diffs)
- trunk/test/wsdl/rpc/test_rpc_lit.rb (modified) (4 diffs)
- trunk/test/wsdl/simpletype/rpc/expectedEchoVersion.rb (modified) (1 diff)
- trunk/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb (modified) (1 diff)
- trunk/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/encodingstyle/literalHandler.rb
r1581 r1584 66 66 end 67 67 when SOAPElement 68 # passes 2 times for simplifying namespace definition 69 data.each do |key, value| 70 if value.elename.namespace 71 SOAPGenerator.assign_ns(attrs, ns, value.elename.namespace) 72 end 73 end 68 74 generator.encode_tag(name, attrs) 69 75 generator.encode_rawstring(data.text) if data.text trunk/lib/soap/mapping/mapping.rb
r1581 r1584 306 306 elements = [] 307 307 as_array = [] 308 schema_ns = klass.class_eval('@@schema_ns') 308 309 klass.class_eval('@@schema_element').each do |varname, definition| 309 310 class_name, name = definition … … 312 313 as_array << (name ? name.name : varname) 313 314 end 314 elements << [name || XSD::QName.new( nil, varname), class_name]315 elements << [name || XSD::QName.new(schema_ns, varname), class_name] 315 316 end 316 317 [elements, as_array] trunk/lib/soap/mapping/wsdlliteralregistry.rb
r1581 r1584 55 55 # node should be a SOAPElement 56 56 def soap2obj(node, obj_class = nil) 57 unless obj_class.nil? 58 raise MappingError.new("must not reach here") 59 end 57 # obj_class is given when rpc/literal service. but ignored for now. 60 58 begin 61 59 return any2obj(node) trunk/lib/soap/rpc/router.rb
r1551 r1584 241 241 end 242 242 if soapaction 243 raise RPCRoutingError.new("operation: #{soapaction} not supported") 243 raise RPCRoutingError.new( 244 "operation: #{soapaction} #{qname} not supported") 244 245 else 245 246 raise RPCRoutingError.new("operation: #{qname} not supported") trunk/lib/wsdl/soap/classDefCreator.rb
r1581 r1584 161 161 params << "#{varname} = nil" 162 162 end 163 eleqname = (varname == name) ? nil : element.name 163 # nil means @@schema_ns + varname 164 eleqname = 165 (varname == name && element.name.namespace == qname.namespace) ? 166 nil : element.name 164 167 schema_element << [varname, eleqname, type] 165 168 end trunk/lib/wsdl/xmlSchema/element.rb
r1580 r1584 108 108 case attr 109 109 when NameAttrName 110 @name = XSD::QName.new(targetnamespace, value.source) 110 namespace = directelement? ? targetnamespace : nil 111 @name = XSD::QName.new(namespace, value.source) 111 112 when FormAttrName 112 113 @form = value.source … … 118 119 if parent.is_a?(All) 119 120 if value.source != '1' 120 raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}") 121 raise Parser::AttrConstraintError.new( 122 "cannot parse #{value} for #{attr}") 121 123 end 122 124 end … … 125 127 if parent.is_a?(All) 126 128 unless ['0', '1'].include?(value.source) 127 raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}") 129 raise Parser::AttrConstraintError.new( 130 "cannot parse #{value} for #{attr}") 128 131 end 129 132 end … … 135 138 end 136 139 end 140 141 private 142 143 def directelement? 144 parent.is_a?(Schema) 145 end 137 146 end 138 147 trunk/test/soap/test_httpconfigloader.rb
r1579 r1584 21 21 # depth: 1 causes an error (intentional) 22 22 protocol.http.ssl_config.verify_depth = 1 23 protocol.http.ssl_config.client_cert = #{File.join(DIR, 'client.cert')}24 protocol.http.ssl_config.client_key = #{File.join(DIR, 'client.key')}25 protocol.http.ssl_config.ca_file = #{File.join(DIR, 'ca.cert')}26 protocol.http.ssl_config.ca_file = #{File.join(DIR, 'subca.cert')}27 23 protocol.http.ssl_config.ciphers = ALL 28 24 __EOP__ … … 30 26 begin 31 27 @client.loadproperty(testpropertyname) 32 @client.options["protocol.http.ssl_config.verify_callback"] = method(:verify_callback).to_proc 33 @verify_callback_called = false 34 begin 35 @client.hello_world("ssl client") 36 assert(false) 37 rescue OpenSSL::SSL::SSLError => ssle 38 assert_equal("certificate verify failed", ssle.message) 39 assert(@verify_callback_called) 40 end 41 # 42 @client.options["protocol.http.ssl_config.verify_depth"] = "" 43 @verify_callback_called = false 44 assert_equal("Hello World, from ssl client", @client.hello_world("ssl client")) 45 assert(@verify_callback_called) 28 assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers']) 46 29 ensure 47 30 File.unlink(testpropertyname) trunk/test/wsdl/any/expectedEcho.rb
r1520 r1584 5 5 @@schema_type = "foo.bar" 6 6 @@schema_ns = "urn:example.com:echo-type" 7 @@schema_element = [["any", nil]]7 @@schema_element = [["any", [nil, XSD::QName.new(nil, "any")]]] 8 8 9 9 attr_accessor :any trunk/test/wsdl/document/echo.rb
r1522 r1584 6 6 @@schema_ns = "urn:docrpc" 7 7 @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} 8 @@schema_element = [["struct1", "Echo_struct"], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]]8 @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 9 9 10 10 attr_accessor :struct1 … … 39 39 @@schema_ns = "urn:docrpc" 40 40 @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} 41 @@schema_element = [["struct1", "Echo_struct"], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]]41 @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 42 42 43 43 attr_accessor :struct1 … … 72 72 @@schema_ns = "urn:docrpc" 73 73 @@schema_attribute = {XSD::QName.new("urn:docrpc", "m_attr") => "SOAP::SOAPString"} 74 @@schema_element = [["m_string", "SOAP::SOAPString"], ["m_datetime", "SOAP::SOAPDateTime"]]74 @@schema_element = [["m_string", ["SOAP::SOAPString", XSD::QName.new(nil, "m_string")]], ["m_datetime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "m_datetime")]]] 75 75 76 76 attr_accessor :m_string trunk/test/wsdl/marshal/person_org.rb
r1520 r1584 5 5 @@schema_type = "Person" 6 6 @@schema_ns = "http://www.jin.gr.jp/~nahi/xmlns/sample/Person" 7 @@schema_element = [["familyname", "SOAP::SOAPString"], ["givenname", "SOAP::SOAPString"], ["var1", "SOAP::SOAPInt"], ["var2", "SOAP::SOAPDouble"], ["var3", "SOAP::SOAPString"]]7 @@schema_element = [["familyname", ["SOAP::SOAPString", XSD::QName.new(nil, "familyname")]], ["givenname", ["SOAP::SOAPString", XSD::QName.new(nil, "givenname")]], ["var1", ["SOAP::SOAPInt", XSD::QName.new(nil, "var1")]], ["var2", ["SOAP::SOAPDouble", XSD::QName.new(nil, "var2")]], ["var3", ["SOAP::SOAPString", XSD::QName.new(nil, "var3")]]] 8 8 9 9 attr_accessor :familyname trunk/test/wsdl/qualified/lp.wsdl
r1580 r1584 16 16 <part name="parameters" element="tns:login" /> 17 17 </message> 18 <message name="login_in2">19 <part name="parameters" element="tns:login2" />20 </message>21 18 <message name="login_out"> 22 19 <part name="parameters" element="tns:loginResponse" /> … … 26 23 <operation name="login"> 27 24 <input message="tns:login_in" /> 28 <output message="tns:login_out" />29 </operation>30 <operation name="login2">31 <input message="tns:login_in2" />32 25 <output message="tns:login_out" /> 33 26 </operation> … … 45 38 </output> 46 39 </operation> 47 <operation name="login2">48 <soap:operation soapAction="urn:lp:login2" style="document" />49 <input>50 <soap:body use="literal" />51 </input>52 <output>53 <soap:body use="literal" />54 </output>55 </operation>56 40 </binding> 57 41 trunk/test/wsdl/qualified/lp.xsd
r1580 r1584 9 9 </xs:complexType> 10 10 11 <xs:element name="login" type="lp:login" form="qualified"/> <!-- qualified --> 12 <xs:element name="login2" type="lp:login"/> <!-- unqualified --> 11 <xs:element name="login" type="lp:login"/> 13 12 14 13 <xs:complexType name="loginResponse"> trunk/test/wsdl/qualified/test_qualified.rb
r1580 r1584 18 18 'login', 19 19 XSD::QName.new(Namespace, 'login'), 20 XSD::QName.new(Namespace, 'loginResponse')21 )22 add_document_method(23 self,24 Namespace + ':login',25 'login',26 XSD::QName.new(Namespace, 'login2'),27 20 XSD::QName.new(Namespace, 'loginResponse') 28 21 ) … … 99 92 <env:Body> 100 93 <n1:login xmlns:n1="urn:lp"> 101 <n1:username>NaHi</n1:username>102 <n1:password>passwd</n1:password>103 <n1:timezone>JST</n1:timezone>104 </n1:login>105 </env:Body>106 </env:Envelope>]107 108 LOGIN_REQUEST_QUALIFIED_DEFAULT =109 %q[<?xml version="1.0" encoding="utf-8" ?>110 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"111 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"112 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">113 <env:Body>114 <login xmlns="urn:lp">115 94 <username>NaHi</username> 116 95 <password>passwd</password> 117 96 <timezone>JST</timezone> 118 </login> 119 </env:Body> 120 </env:Envelope>] 121 122 LOGIN_REQUEST_UNQUALIFIED = 123 %q[<?xml version="1.0" encoding="utf-8" ?> 124 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 125 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 126 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 127 <env:Body> 128 <n1:login2 xmlns:n1="urn:lp"> 129 <username>NaHi</username> 130 <password>passwd</password> 131 <timezone>JST</timezone> 132 </n1:login2> 97 </n1:login> 133 98 </env:Body> 134 99 </env:Envelope>] … … 149 114 :username => 'NaHi') 150 115 assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 151 152 @client.wiredump_dev = str = ''153 @client.login2(:timezone => 'JST', :password => 'passwd',154 :username => 'NaHi')155 assert_equal(LOGIN_REQUEST_UNQUALIFIED, parse_requestxml(str))156 116 end 157 117 … … 169 129 @client.wiredump_dev = str = '' 170 130 @client.login(Login.new('NaHi', 'passwd', 'JST')) 171 assert_equal(LOGIN_REQUEST_QUALIFIED_DEFAULT, parse_requestxml(str)) 172 173 @client.wiredump_dev = str = '' 174 @client.login2(Login.new('NaHi', 'passwd', 'JST')) 175 assert_equal(LOGIN_REQUEST_UNQUALIFIED, parse_requestxml(str)) 131 assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 176 132 end 177 133 trunk/test/wsdl/ref/expectedProduct.rb
r1522 r1584 13 13 @@schema_ns = "urn:product" 14 14 @@schema_attribute = {XSD::QName.new("urn:product", "version") => "SOAP::SOAPString", XSD::QName.new("urn:product", "yesno") => "SOAP::SOAPString"} 15 @@schema_element = [["bag", "Product[]"], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", nil], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]]15 @@schema_element = [["bag", ["Product[]", XSD::QName.new(nil, "bag")]], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", [nil, XSD::QName.new(nil, "comment_1")]], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]] 16 16 17 17 attr_accessor :bag … … 68 68 @@schema_type = "Product" 69 69 @@schema_ns = "urn:product" 70 @@schema_element = [["name", "SOAP::SOAPString"], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]]70 @@schema_element = [["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]] 71 71 72 72 attr_accessor :name trunk/test/wsdl/rpc/test-rpc-lit.wsdl
r1581 r1584 19 19 </complexType> 20 20 21 <complexType name="ArrayOfstringInline"> 22 <sequence> 23 <element name="stringItem" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> 24 </sequence> 25 </complexType> 26 21 27 <complexType name="ArrayOfint"> 22 28 <sequence> … … 122 128 </message> 123 129 130 <message name="echoStringArrayInlineRequest"> 131 <part name="inputStringArray" type="types:ArrayOfstringInline"/> 132 </message> 133 <message name="echoStringArrayInlineResponse"> 134 <part name="return" type="types:ArrayOfstringInline"/> 135 </message> 136 124 137 <!-- echoIntegerArray rpc operation --> 125 138 <message name="echoIntegerArrayRequest"> … … 191 204 </operation> 192 205 206 <operation name="echoStringArrayInline" parameterOrder="inputStringArray"> 207 <input message="tns:echoStringArrayInlineRequest"/> 208 <output message="tns:echoStringArrayInlineResponse"/> 209 </operation> 210 193 211 <!-- echoIntegerArray rpc operation --> 194 212 <operation name="echoIntegerArray" parameterOrder="inputIntegerArray"> … … 291 309 </operation> 292 310 311 <operation name="echoStringArrayInline"> 312 <soap11:operation soapAction="http://soapinterop.org/"/> 313 <input> 314 <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" /> 315 </input> 316 <output> 317 <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" /> 318 </output> 319 </operation> 320 293 321 <!-- echoIntegerArray rpc operation --> 294 322 <operation name="echoIntegerArray"> trunk/test/wsdl/rpc/test_rpc_lit.rb
r1581 r1584 28 28 } 29 29 ) 30 add_rpc_operation(self, 31 XSD::QName.new(Namespace, 'echoStringArrayInline'), 32 nil, 33 'echoStringArrayInline', [ 34 ['in', 'inputStringArray', nil], 35 ['retval', 'return', nil] 36 ], 37 { 38 :request_style => :rpc, 39 :request_use => :literal, 40 :response_style => :rpc, 41 :response_use => :literal 42 } 43 ) 44 add_rpc_operation(self, 45 XSD::QName.new(Namespace, 'echoNestedStruct'), 46 nil, 47 'echoNestedStruct', [ 48 ['in', 'inputNestedStruct', nil], 49 ['retval', 'return', nil] 50 ], 51 { 52 :request_style => :rpc, 53 :request_use => :literal, 54 :response_style => :rpc, 55 :response_use => :literal 56 } 57 ) 58 add_rpc_operation(self, 59 XSD::QName.new(Namespace, 'echoStructArray'), 60 nil, 61 'echoStructArray', [ 62 ['in', 'inputStructArray', nil], 63 ['retval', 'return', nil] 64 ], 65 { 66 :request_style => :rpc, 67 :request_use => :literal, 68 :response_style => :rpc, 69 :response_use => :literal 70 } 71 ) 30 72 end 31 73 … … 33 75 # strings.stringItem => Array 34 76 ArrayOfstring[*strings.stringItem] 77 end 78 79 def echoStringArrayInline(strings) 80 ArrayOfstringInline[*strings.stringItem] 81 end 82 83 def echoNestedStruct(struct) 84 struct 85 end 86 87 def echoStructArray(ary) 88 ary 35 89 end 36 90 end … … 98 152 end 99 153 100 def test_wsdl 154 def test_wsdl_echoStringArray 101 155 wsdl = pathname('test-rpc-lit.wsdl') 102 156 @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver … … 108 162 end 109 163 110 def test_stub 164 ECHO_STRING_ARRAY_REQUEST = 165 %q[<?xml version="1.0" encoding="utf-8" ?> 166 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 167 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 168 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 169 <env:Body> 170 <n1:echoStringArray xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 171 <inputStringArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 172 <n2:stringItem>a</n2:stringItem> 173 <n2:stringItem>b</n2:stringItem> 174 <n2:stringItem>c</n2:stringItem> 175 </inputStringArray> 176 </n1:echoStringArray> 177 </env:Body> 178 </env:Envelope>] 179 180 ECHO_STRING_ARRAY_RESPONSE = 181 %q[<?xml version="1.0" encoding="utf-8" ?> 182 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 183 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 184 <env:Body> 185 <n1:echoStringArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 186 <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 187 <n2:stringItem>a</n2:stringItem> 188 <n2:stringItem>b</n2:stringItem> 189 <n2:stringItem>c</n2:stringItem> 190 </return> 191 </n1:echoStringArrayResponse> 192 </env:Body> 193 </env:Envelope>] 194 195 def test_stub_echoStringArray 111 196 drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 112 drv.wiredump_dev = STDOUT if $DEBUG 197 drv.wiredump_dev = str = '' 198 # response contains only 1 part. 113 199 result = drv.echoStringArray(ArrayOfstring["a", "b", "c"])[0] 114 200 assert_equal(["a", "b", "c"], result.stringItem) 201 assert_equal(ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str)) 202 assert_equal(ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str)) 203 end 204 205 ECHO_STRING_ARRAY_INLINE_REQUEST = 206 %q[<?xml version="1.0" encoding="utf-8" ?> 207 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 208 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 209 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 210 <env:Body> 211 <n1:echoStringArrayInline xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 212 <inputStringArray> 213 <stringItem>a</stringItem> 214 <stringItem>b</stringItem> 215 <stringItem>c</stringItem> 216 </inputStringArray> 217 </n1:echoStringArrayInline> 218 </env:Body> 219 </env:Envelope>] 220 221 ECHO_STRING_ARRAY_INLINE_RESPONSE = 222 %q[<?xml version="1.0" encoding="utf-8" ?> 223 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 224 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 225 <env:Body> 226 <n1:echoStringArrayInlineResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 227 <return> 228 <stringItem>a</stringItem> 229 <stringItem>b</stringItem> 230 <stringItem>c</stringItem> 231 </return> 232 </n1:echoStringArrayInlineResponse> 233 </env:Body> 234 </env:Envelope>] 235 236 def test_stub_echoStringArrayInline 237 drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 238 drv.wiredump_dev = str = '' 239 # response contains only 1 part. 240 result = drv.echoStringArrayInline(ArrayOfstringInline["a", "b", "c"])[0] 241 assert_equal(["a", "b", "c"], result.stringItem) 242 assert_equal(ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str)) 243 assert_equal(ECHO_STRING_ARRAY_INLINE_RESPONSE, parse_responsexml(str)) 244 end 245 246 ECHO_NESTED_STRUCT_REQUEST = 247 %q[<?xml version="1.0" encoding="utf-8" ?> 248 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 249 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 250 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 251 <env:Body> 252 <n1:echoNestedStruct xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 253 <inputStruct xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 254 <varString>str</varString> 255 <varInt>1</varInt> 256 <varFloat>+1</varFloat> 257 <n2:structItem> 258 <varString>str</varString> 259 <varInt>1</varInt> 260 <varFloat>+1</varFloat> 261 </n2:structItem> 262 </inputStruct> 263 </n1:echoNestedStruct> 264 </env:Body> 265 </env:Envelope>] 266 267 ECHO_NESTED_STRUCT_RESPONSE = 268 %q[<?xml version="1.0" encoding="utf-8" ?> 269 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 270 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 271 <env:Body> 272 <n1:echoNestedStructResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 273 <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 274 <varString>str</varString> 275 <varInt>1</varInt> 276 <varFloat>+1</varFloat> 277 <n2:structItem> 278 <varString>str</varString> 279 <varInt>1</varInt> 280 <varFloat>+1</varFloat> 281 </n2:structItem> 282 </return> 283 </n1:echoNestedStructResponse> 284 </env:Body> 285 </env:Envelope>] 286 287 def test_wsdl_echoNestedStruct 288 wsdl = pathname('test-rpc-lit.wsdl') 289 @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 290 @client.endpoint_url = "http://localhost:#{Port}/" 291 @client.wiredump_dev = str = '' 292 # response contains only 1 part. 293 result = @client.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0] 294 assert_equal('str', result.varString) 295 assert_equal('1', result.varInt) 296 assert_equal('+1', result.varFloat) 297 assert_equal('str', result.structItem.varString) 298 assert_equal('1', result.structItem.varInt) 299 assert_equal('+1', result.structItem.varFloat) 300 assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str)) 301 assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str)) 302 end 303 304 def test_stub_echoNestedStruct 305 drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 306 drv.wiredump_dev = str = '' 307 # response contains only 1 part. 308 result = drv.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0] 309 assert_equal('str', result.varString) 310 assert_equal('1', result.varInt) 311 assert_equal('+1', result.varFloat) 312 assert_equal('str', result.structItem.varString) 313 assert_equal('1', result.structItem.varInt) 314 assert_equal('+1', result.structItem.varFloat) 315 assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str)) 316 assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str)) 317 end 318 319 ECHO_STRUCT_ARRAY_REQUEST = 320 %q[<?xml version="1.0" encoding="utf-8" ?> 321 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 322 xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 323 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 324 <env:Body> 325 <n1:echoStructArray xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 326 <inputStructArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 327 <n2:structItem> 328 <varString>str</varString> 329 <varInt>2</varInt> 330 <varFloat>+2.1</varFloat> 331 </n2:structItem> 332 <n2:structItem> 333 <varString>str</varString> 334 <varInt>2</varInt> 335 <varFloat>+2.1</varFloat> 336 </n2:structItem> 337 </inputStructArray> 338 </n1:echoStructArray> 339 </env:Body> 340 </env:Envelope>] 341 342 ECHO_STRUCT_ARRAY_RESPONSE = 343 %q[<?xml version="1.0" encoding="utf-8" ?> 344 <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 345 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 346 <env:Body> 347 <n1:echoStructArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 348 <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 349 <n2:structItem> 350 <varString>str</varString> 351 <varInt>2</varInt> 352 <varFloat>+2.1</varFloat> 353 </n2:structItem> 354 <n2:structItem> 355 <varString>str</varString> 356 <varInt>2</varInt> 357 <varFloat>+2.1</varFloat> 358 </n2:structItem> 359 </return> 360 </n1:echoStructArrayResponse> 361 </env:Body> 362 </env:Envelope>] 363 364 def test_wsdl_echoStructArray 365 wsdl = pathname('test-rpc-lit.wsdl') 366 @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 367 @client.endpoint_url = "http://localhost:#{Port}/" 368 @client.wiredump_dev = str = '' 369 # response contains only 1 part. 370 e = SOAPStruct.new("str", 2, 2.1) 371 result = @client.echoStructArray(ArrayOfSOAPStruct[e, e]) 372 assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str)) 373 assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str)) 374 end 375 376 def test_stub_echoStructArray 377 drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 378 drv.wiredump_dev = str = '' 379 # response contains only 1 part. 380 e = SOAPStruct.new("str", 2, 2.1) 381 result = drv.echoStructArray(ArrayOfSOAPStruct[e, e]) 382 assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str)) 383 assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str)) 384 end 385 386 def parse_requestxml(str) 387 str.split(/\r?\n\r?\n/)[3] 388 end 389 390 def parse_responsexml(str) 391 str.split(/\r?\n\r?\n/)[6] 115 392 end 116 393 end trunk/test/wsdl/simpletype/rpc/expectedEchoVersion.rb
r1520 r1584 5 5 @@schema_type = "version_struct" 6 6 @@schema_ns = "urn:example.com:simpletype-rpc-type" 7 @@schema_element = [["version", "SOAP::SOAPString"], ["msg", "SOAP::SOAPString"]]7 @@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]] 8 8 9 9 attr_accessor :version trunk/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb
r1520 r1584 5 5 @@schema_type = "version_struct" 6 6 @@schema_ns = "urn:example.com:simpletype-rpc-type" 7 @@schema_element = [["version", "SOAP::SOAPString"], ["msg", "SOAP::SOAPString"]]7 @@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]] 8 8 9 9 attr_accessor :version trunk/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb
r1581 r1584 5 5 @@schema_type = "question" 6 6 @@schema_ns = "urn:mysample" 7 @@schema_element = [["something", "SOAP::SOAPString"]]7 @@schema_element = [["something", ["SOAP::SOAPString", XSD::QName.new(nil, "something")]]] 8 8 9 9 attr_accessor :something … … 18 18 @@schema_type = "section" 19 19 @@schema_ns = "urn:mysample" 20 @@schema_element = [["sectionID", "SOAP::SOAPInt"], ["name", "SOAP::SOAPString"], ["description", "SOAP::SOAPString"], ["index", "SOAP::SOAPInt"], ["firstQuestion", "Question"]]20 @@schema_element = [["sectionID", ["SOAP::SOAPInt", XSD::QName.new(nil, "sectionID")]], ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]], ["index", ["SOAP::SOAPInt", XSD::QName.new(nil, "index")]], ["firstQuestion", ["Question", XSD::QName.new(nil, "firstQuestion")]]] 21 21 22 22 attr_accessor :sectionID