diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 14:41:10 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-20 14:41:10 +0000 |
commit | e8ed175fe02aecab21ce50e85e27fe79137d8c31 (patch) | |
tree | 8a6d14560604b592f177ffaaa0c146c756edb2e9 /lib/wsdl/soap/methodDefCreator.rb | |
parent | 330a8e51c56f5386753f55ba8e656a62471a36ba (diff) |
* added files:
* lib/soap/mapping/wsdl*.rb
* lib/wsdl/soap/element.rb
* lib/wsdl/xmlSchema/simpleContent.rb
* modified files:
* lib/soap/*
* lib/wsdl/*
* lib/xsd/*
* test/soap/*
* test/wsdl/*
* test/xsd/*
* sample/soap/*
* sample/sdl/*
* summary
* imported from the soap4r repository. Version: 1.5.3-ruby1.8.2
* added several XSD basetype support: nonPositiveInteger,
negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt,
unsignedShort, unsignedByte, positiveInteger
* HTTP client connection/send/receive timeout support.
* HTTP client/server gzipped content encoding support.
* improved WSDL schema definition support; still is far from
complete, but is making step by step improovement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/wsdl/soap/methodDefCreator.rb')
-rw-r--r-- | lib/wsdl/soap/methodDefCreator.rb | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/lib/wsdl/soap/methodDefCreator.rb b/lib/wsdl/soap/methodDefCreator.rb index eded972cdc..59b8ee4253 100644 --- a/lib/wsdl/soap/methodDefCreator.rb +++ b/lib/wsdl/soap/methodDefCreator.rb @@ -45,9 +45,15 @@ private def dump_method(operation, binding) name = safemethodname(operation.name.name) name_as = operation.name.name - params = collect_parameter(operation) - soapaction = binding.soapoperation.soapaction - namespace = binding.input.soapbody.namespace + stylestr = binding.soapoperation.operation_style.id2name + if binding.soapoperation.operation_style == :rpc + soapaction = binding.soapoperation.soapaction + namespace = binding.input.soapbody.namespace + params = collect_rpcparameter(operation) + else + soapaction = namespace = nil + params = collect_documentparameter(operation) + end paramstr = param2str(params) if paramstr.empty? paramstr = '[]' @@ -57,36 +63,45 @@ private return <<__EOD__ [#{ dq(name_as) }, #{ dq(name) }, #{ paramstr }, - #{ soapaction ? dq(soapaction) : "nil" }, #{ dq(namespace) } + #{ ndq(soapaction) }, #{ ndq(namespace) }, #{ sym(stylestr) } ] __EOD__ end - def collect_parameter(operation) + def collect_rpcparameter(operation) result = operation.inputparts.collect { |part| collect_type(part.type) - param_set('in', definedtype(part), part.name) + param_set('in', rpcdefinedtype(part), part.name) } outparts = operation.outputparts if outparts.size > 0 retval = outparts[0] collect_type(retval.type) - result << param_set('retval', definedtype(retval), retval.name) + result << param_set('retval', rpcdefinedtype(retval), retval.name) cdr(outparts).each { |part| collect_type(part.type) - result << param_set('out', definedtype(part), part.name) + result << param_set('out', rpcdefinedtype(part), part.name) } end result end - def definedtype(part) + def collect_documentparameter(operation) + input = operation.inputparts[0] + output = operation.outputparts[0] + [ + param_set('input', documentdefinedtype(input), input.name), + param_set('output', documentdefinedtype(output), output.name) + ] + end + + def rpcdefinedtype(part) if mapped = basetype_mapped_class(part.type) ['::' + mapped.name] - elsif definedelement = @elements[part.element] - raise RuntimeError.new("Part: #{part.name} should be typed for RPC service for now.") elsif definedtype = @simpletypes[part.type] ['::' + basetype_mapped_class(definedtype.base).name] + elsif definedtype = @elements[part.element] + ['::SOAP::SOAPStruct', part.element.namespace, part.element.name] elsif definedtype = @complextypes[part.type] case definedtype.compoundtype when :TYPE_STRUCT @@ -104,6 +119,18 @@ __EOD__ end end + def documentdefinedtype(part) + if definedtype = @simpletypes[part.type] + ['::' + basetype_mapped_class(definedtype.base).name, nil, part.name] + elsif definedtype = @elements[part.element] + ['::SOAP::SOAPElement', part.element.namespace, part.element.name] + elsif definedtype = @complextypes[part.type] + ['::SOAP::SOAPElement', part.type.namespace, part.type.name] + else + raise RuntimeError.new("Part: #{part.name} cannot be resolved.") + end + end + def param_set(io_type, type, name) [io_type, type, name] end @@ -128,14 +155,10 @@ __EOD__ if type.size == 1 "[#{ type[0] }]" else - "[#{ type[0] }, #{ dq(type[1]) }, #{ dq(type[2]) }]" + "[#{ type[0] }, #{ ndq(type[1]) }, #{ dq(type[2]) }]" end end - def dq(ele) - "\"" << ele << "\"" - end - def cdr(ary) result = ary.dup result.shift |