summaryrefslogtreecommitdiff
path: root/lib/wsdl/soap/methodDefCreator.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl/soap/methodDefCreator.rb')
-rw-r--r--lib/wsdl/soap/methodDefCreator.rb77
1 files changed, 60 insertions, 17 deletions
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