Class: WSDL::SOAP::MethodDefCreator

Inherits:
Object
  • Object
show all
Includes:
ClassDefCreatorSupport
Defined in:
lib/wsdl/soap/methodDefCreator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ClassDefCreatorSupport

#assign_const, #basetype_mapped_class, #create_type_name, #dq, #dqname, #dump_method_signature, #mapped_class_basename, #mapped_class_name, #ndq, #nsym, #sym

Methods included from XSD::CodeGen::GenSupport

capitalize, constant?, #format, keyword?, safeconstname, safeconstname?, safemethodname, safemethodname?, safevarname, safevarname?, uncapitalize

Constructor Details

#initialize(definitions, name_creator, modulepath, defined_const) ⇒ MethodDefCreator

Returns a new instance of MethodDefCreator.


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/wsdl/soap/methodDefCreator.rb', line 23

def initialize(definitions, name_creator, modulepath, defined_const)
  @definitions = definitions
  @name_creator = name_creator
  @modulepath = modulepath
  @simpletypes = @definitions.collect_simpletypes
  @complextypes = @definitions.collect_complextypes
  @elements = @definitions.collect_elements
  @types = []
  @encoded = false
  @literal = false
  @defined_const = defined_const
end

Instance Attribute Details

#definitionsObject (readonly)

Returns the value of attribute definitions


21
22
23
# File 'lib/wsdl/soap/methodDefCreator.rb', line 21

def definitions
  @definitions
end

Instance Method Details

#collect_documentparameter(operation) ⇒ Object


81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/wsdl/soap/methodDefCreator.rb', line 81

def collect_documentparameter(operation)
  param = []
  operation.inputparts.each do |input|
    param << param_set(::SOAP::RPC::SOAPMethod::IN, input.name,
      documentdefinedtype(input))
  end
  operation.outputparts.each do |output|
    param << param_set(::SOAP::RPC::SOAPMethod::OUT, output.name,
      documentdefinedtype(output))
  end
  param
end

#collect_rpcparameter(operation) ⇒ Object


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/wsdl/soap/methodDefCreator.rb', line 61

def collect_rpcparameter(operation)
  result = operation.inputparts.collect { |part|
    collect_type(part.type)
    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, retval.name,
      rpcdefinedtype(retval))
    cdr(outparts).each { |part|
	collect_type(part.type)
	result << param_set(::SOAP::RPC::SOAPMethod::OUT, part.name,
        rpcdefinedtype(part))
    }
  end
  result
end

#dump(name) ⇒ Object


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/wsdl/soap/methodDefCreator.rb', line 36

def dump(name)
  @types.clear
  @encoded = false
  @literal = false
  methoddef = ""
  porttype = @definitions.porttype(name)
  binding = porttype.find_binding
  if binding
    binding.operations.each do |op_bind|
      next unless op_bind # no binding is defined
      next unless op_bind.soapoperation # not a SOAP operation binding
      op = op_bind.find_operation
      methoddef << ",\n" unless methoddef.empty?
      methoddef << dump_method(op, op_bind).chomp
    end
  end
  result = {
    :methoddef => methoddef,
    :types => @types,
    :encoded => @encoded,
    :literal => @literal
  }
  result
end