From 290034fde815cbc389d29d3111553dbde4ab676a Mon Sep 17 00:00:00 2001 From: nahi Date: Sun, 18 Jan 2004 11:10:18 +0000 Subject: * lib/soap/wsdlDriver.rb, lib/wsdl/soap/operation.rb: add support of "parts" attribute of soap:body element in WSDL. * lib/wsdl/xmlSchema/schema.rb: friendly warning message for simpleType element which is not supported for now. * test/wsdl/soap/{soapbodyparts.wsdl,test_soapbodyparts.wsdl}: new files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ MANIFEST | 3 +++ lib/soap/wsdlDriver.rb | 24 +++++++++++++++++++----- lib/wsdl/soap/operation.rb | 5 ++++- lib/wsdl/xmlSchema/schema.rb | 3 +++ 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b026044cf2..5bfa533886 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sun Jan 18 20:00:16 2004 NAKAMURA, Hiroshi + + * lib/soap/wsdlDriver.rb, lib/wsdl/soap/operation.rb: add support of + "parts" attribute of soap:body element in WSDL. + + * lib/wsdl/xmlSchema/schema.rb: friendly warning message for + simpleType element which is not supported for now. + + * test/wsdl/soap/{soapbodyparts.wsdl,test_soapbodyparts.wsdl}: new + files. + Sun Jan 18 16:46:48 2004 Nobuyoshi Nakada * time.c (time_overflow_p): should return results. [ruby-dev:22614] diff --git a/MANIFEST b/MANIFEST index cc37ae8962..8fb1d5aac2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -749,6 +749,7 @@ test/ruby/test_signal.rb test/ruby/test_stringchar.rb test/ruby/test_struct.rb test/ruby/test_system.rb +test/ruby/test_time.rb test/ruby/test_trace.rb test/ruby/test_variable.rb test/ruby/test_whileuntil.rb @@ -821,6 +822,8 @@ test/wsdl/raa/RAAService.rb test/wsdl/raa/README.txt test/wsdl/raa/raa.wsdl test/wsdl/raa/test_raa.rb +test/wsdl/soap/soapbodyparts.wsdl +test/wsdl/soap/test_soapbodyparts.rb test/wsdl/test_emptycomplextype.rb test/wsdl/test_fault.rb test/xsd/noencoding.xml diff --git a/lib/soap/wsdlDriver.rb b/lib/soap/wsdlDriver.rb index cd93e3dee7..4b36bd08b8 100644 --- a/lib/soap/wsdlDriver.rb +++ b/lib/soap/wsdlDriver.rb @@ -206,11 +206,7 @@ class WSDLDriver log(DEBUG) { "call: parameters '#{ params.inspect }'." } op_info = @operations[method_name] - parts_names = op_info.bodyparts.collect { |part| part.name } - obj = create_method_obj(parts_names, params) - method = Mapping.obj2soap(obj, @wsdl_mapping_registry, op_info.optype_name) - method.elename = op_info.op_name - method.type = XSD::QName.new # Request should not be typed. + method = create_method_struct(op_info, params) req_header = nil req_body = SOAPBody.new(method) req_env = SOAPEnvelope.new(req_header, req_body) @@ -264,6 +260,24 @@ class WSDLDriver private + def create_method_struct(op_info, params) + parts_names = op_info.bodyparts.collect { |part| part.name } + obj = create_method_obj(parts_names, params) + method = Mapping.obj2soap(obj, @wsdl_mapping_registry, op_info.optype_name) + if method.members.size != parts_names.size + new_method = SOAPStruct.new + method.each do |key, value| + if parts_names.include?(key) + new_method.add(key, value) + end + end + method = new_method + end + method.elename = op_info.op_name + method.type = XSD::QName.new # Request should not be typed. + method + end + def create_method_obj(names, params) o = Object.new for idx in 0 ... params.length diff --git a/lib/wsdl/soap/operation.rb b/lib/wsdl/soap/operation.rb index e50356cf35..bb49f2099c 100644 --- a/lib/wsdl/soap/operation.rb +++ b/lib/wsdl/soap/operation.rb @@ -104,7 +104,10 @@ private op_name.namespace = soapbody.namespace end if soapbody.parts - raise NotImplementedError.new("soap:body parts") + target = soapbody.parts.split(/\s+/) + bodyparts = name_info.parts.find_all { |part| + target.include?(part.name) + } else bodyparts = name_info.parts end diff --git a/lib/wsdl/xmlSchema/schema.rb b/lib/wsdl/xmlSchema/schema.rb index 1d7759605e..b2a195d41f 100644 --- a/lib/wsdl/xmlSchema/schema.rb +++ b/lib/wsdl/xmlSchema/schema.rb @@ -43,6 +43,9 @@ class Schema < Info o = ComplexType.new @complextypes << o o + when SimpleTypeName + STDERR.puts("Restriction of basetype with simpleType definition is ignored for now.") + nil when ElementName o = Element.new @elements << o -- cgit v1.2.3