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

#basetype_mapped_class, #create_class_name, #dq, #dqname, #dump_method_signature, #ndq, #nsym, #sym

Methods included from XSD::CodeGen::GenSupport

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

Constructor Details

#initialize(definitions, modulepath) ⇒ MethodDefCreator

Returns a new instance of MethodDefCreator.


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

def initialize(definitions, modulepath)
  @definitions = definitions
  @modulepath = modulepath
  @simpletypes = @definitions.collect_simpletypes
  @complextypes = @definitions.collect_complextypes
  @elements = @definitions.collect_elements
  @types = []
  @encoded = false
  @literal = false
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


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

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


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

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(porttype) ⇒ Object


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

def dump(porttype)
  @types.clear
  @encoded = false
  @literal = false
  methoddef = ""
  port = @definitions.porttype(porttype)
  binding = port.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