From 533c24268e485c1de7d7fbe6d947681df5a48382 Mon Sep 17 00:00:00 2001 From: nahi Date: Thu, 15 Sep 2005 14:47:07 +0000 Subject: * lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.5. #nnn is a ticket number at http://dev.ctor.org/soap4r * SOAP * allow to configure an envelope namespace of SOAP request. (#124) TemporaryNamespace = 'http://www.w3.org/2003/05/soap-envelope' @client.options["soap.envelope.requestnamespace"] = TemporaryNamespace @client.options["soap.envelope.responsenamespace"] = TemporaryNamespace @client.do_proc(...) * let SOAP request XML indent space configuable. see "soap.envelope.no_indent" option. (#130) * let external CES configuable. ex. client["soap.mapping.external_ces"] = 'SJIS'. $KCODE is used by default. (#133) external CES ::= CES used in Ruby object of client and server internal CES ::= CES used in SOAP/OM * add iso-8859-1 external CES support. (#106) * fixed illegal 'qualified' handling of elements. it caused ASP.NET inteoperability problem. (#144) * added 'soap.envelope.use_numeric_character_reference' (boolean) option to let query XML use numeric character reference in XML, not plain UTF-8 character. !GoogleSearch server seems to not allow plain UTF-8 character since 2005-08-15 update. (#147) * SOAP::Header::SimpleHeader (de)serialization throws an exception on !SimpleHeader.on_(in|out)bound when header is a String. so we could not use a simple single element headerItem. fixed. thanks to emil. (#129) * out parameter of rpc operation did not work. (#132) * follow HTTP redirect only if using http-access2. (#125) (#145) * add a workaround for importing an WSDL whose path begins with drive letter. (#115) * WSDL * SOAP Data which is defined as a simpletype was not mapped correctly to Ruby obj when using wsdl2ruby.rb generated classdef file. (#123) * rpc/literal support. (#118) * re-implemented local element qualify/unqualify control. handles elementFormDefault and form in WSDL. (#119) * Array of an element which has simpleType causes a crash. (#128) * prarmeterOrder may not contain return part so it can be shorter than parts size. Thanks to Hugh. (#139) * Samples * added !BasicAuth client sample. (#117) * added Base64 client/server sample. * added Flickr SOAP interface client sample. (#122) * added !SalesForce client sample. (#135) * updated Thawte CA certificate for !GoogleAdWords sample. * updated a client script with the newer version made by Johan. thanks! * shortened long file names. (#120) * fixed typo in authheader sample. (#129) * updated deprecated method usage. (#138) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/wsdl/soap/methodDefCreator.rb | 77 ++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 17 deletions(-) (limited to 'lib/wsdl/soap/methodDefCreator.rb') diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb index f256b42451..f3ffadbe69 100644 --- a/lib/wsdl/soap/methodDefCreator.rb +++ b/lib/wsdl/soap/methodDefCreator.rb @@ -46,18 +46,18 @@ class MethodDefCreator def collect_rpcparameter(operation) result = operation.inputparts.collect { |part| collect_type(part.type) - param_set(::SOAP::RPC::SOAPMethod::IN, rpcdefinedtype(part), part.name) + param_set(::SOAP::RPC::SOAPMethod::IN, part.name, rpcdefinedtype(part)) } outparts = operation.outputparts if outparts.size > 0 retval = outparts[0] collect_type(retval.type) - result << param_set(::SOAP::RPC::SOAPMethod::RETVAL, - rpcdefinedtype(retval), retval.name) + result << param_set(::SOAP::RPC::SOAPMethod::RETVAL, retval.name, + rpcdefinedtype(retval)) cdr(outparts).each { |part| collect_type(part.type) - result << param_set(::SOAP::RPC::SOAPMethod::OUT, rpcdefinedtype(part), - part.name) + result << param_set(::SOAP::RPC::SOAPMethod::OUT, part.name, + rpcdefinedtype(part)) } end result @@ -66,12 +66,12 @@ class MethodDefCreator def collect_documentparameter(operation) param = [] operation.inputparts.each do |input| - param << param_set(::SOAP::RPC::SOAPMethod::IN, - documentdefinedtype(input), input.name) + param << param_set(::SOAP::RPC::SOAPMethod::IN, input.name, + documentdefinedtype(input), elementqualified(input)) end operation.outputparts.each do |output| - param << param_set(::SOAP::RPC::SOAPMethod::OUT, - documentdefinedtype(output), output.name) + param << param_set(::SOAP::RPC::SOAPMethod::OUT, output.name, + documentdefinedtype(output), elementqualified(output)) end param end @@ -82,23 +82,38 @@ private name = safemethodname(operation.name.name) name_as = operation.name.name style = binding.soapoperation_style + inputuse = binding.input.soapbody_use + outputuse = binding.output.soapbody_use namespace = binding.input.soapbody.namespace if style == :rpc + qname = XSD::QName.new(namespace, name_as) paramstr = param2str(collect_rpcparameter(operation)) else + qname = nil paramstr = param2str(collect_documentparameter(operation)) end if paramstr.empty? paramstr = '[]' else - paramstr = "[\n" << paramstr.gsub(/^/, ' ') << "\n ]" + paramstr = "[ " << paramstr.split(/\r?\n/).join("\n ") << " ]" end - return <<__EOD__ -[#{dq(name_as)}, #{dq(name)}, + definitions = <<__EOD__ +#{ndq(binding.soapaction)}, + #{dq(name)}, #{paramstr}, - #{ndq(binding.soapaction)}, #{ndq(namespace)}, #{sym(style.id2name)} -] + { :request_style => #{sym(style.id2name)}, :request_use => #{sym(inputuse.id2name)}, + :response_style => #{sym(style.id2name)}, :response_use => #{sym(outputuse.id2name)} } __EOD__ + if style == :rpc + return <<__EOD__ +[ #{qname.dump}, + #{definitions}] +__EOD__ + else + return <<__EOD__ +[ #{definitions}] +__EOD__ + end end def rpcdefinedtype(part) @@ -144,8 +159,22 @@ __EOD__ end end - def param_set(io_type, type, name) - [io_type, type, name] + def elementqualified(part) + if mapped = basetype_mapped_class(part.type) + false + elsif definedtype = @simpletypes[part.type] + false + elsif definedtype = @elements[part.element] + definedtype.elementform == 'qualified' + elsif definedtype = @complextypes[part.type] + false + else + raise RuntimeError.new("part: #{part.name} cannot be resolved") + end + end + + def param_set(io_type, name, type, ele = nil) + [io_type, name, type, ele] end def collect_type(type) @@ -161,7 +190,12 @@ __EOD__ def param2str(params) params.collect { |param| - "[#{dq(param[0])}, #{dq(param[2])}, #{type2str(param[1])}]" + io, name, type, ele = param + unless ele.nil? + "[#{dq(io)}, #{dq(name)}, #{type2str(type)}, #{ele2str(ele)}]" + else + "[#{dq(io)}, #{dq(name)}, #{type2str(type)}]" + end }.join(",\n") end @@ -173,6 +207,15 @@ __EOD__ end end + def ele2str(ele) + qualified = ele + if qualified + "true" + else + "false" + end + end + def cdr(ary) result = ary.dup result.shift -- cgit v1.2.3