Class: SOAP::WSDLDriverFactory

Inherits:
Object
  • Object
show all
Includes:
WSDL::SOAP::ClassDefCreatorSupport
Defined in:
lib/soap/wsdlDriver.rb

Defined Under Namespace

Classes: FactoryError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WSDL::SOAP::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(wsdl) ⇒ WSDLDriverFactory

Returns a new instance of WSDLDriverFactory.



33
34
35
# File 'lib/soap/wsdlDriver.rb', line 33

def initialize(wsdl)
  @wsdl = import(wsdl)
end

Instance Attribute Details

#wsdlObject (readonly)

Returns the value of attribute wsdl.



31
32
33
# File 'lib/soap/wsdlDriver.rb', line 31

def wsdl
  @wsdl
end

Instance Method Details

#create_rpc_driver(servicename = nil, portname = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/soap/wsdlDriver.rb', line 41

def create_rpc_driver(servicename = nil, portname = nil)
  port = find_port(servicename, portname)
  drv = SOAP::RPC::Driver.new(port.soap_address.location)
  if binding = port.find_binding
    init_driver(drv, binding)
    add_operation(drv, binding)
  end
  drv
end

#dump_method_signatures(servicename = nil, portname = nil) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/soap/wsdlDriver.rb', line 51

def dump_method_signatures(servicename = nil, portname = nil)
  targetservice = XSD::QName.new(@wsdl.targetnamespace, servicename) if servicename
  targetport = XSD::QName.new(@wsdl.targetnamespace, portname) if portname
  sig = []
  element_definitions = @wsdl.collect_elements
  @wsdl.services.each do |service|
    next if targetservice and service.name != targetservice
    service.ports.each do |port|
      next if targetport and port.name != targetport
      if porttype = port.porttype
        assigned_method = collect_assigned_method(porttype.name)
        if binding = port.porttype.find_binding
          sig << binding.operations.collect { |op_bind|
            operation = op_bind.find_operation
            name = assigned_method[op_bind.boundid] || op_bind.name
            str = "= #{safemethodname(name)}\n\n"
            str << dump_method_signature(name, operation, element_definitions)
            str.gsub(/^#/, " ")
          }.join("\n")
        end
      end
    end
  end
  sig.join("\n")
end

#inspectObject



37
38
39
# File 'lib/soap/wsdlDriver.rb', line 37

def inspect
  sprintf("#<%s:%s:0x%x\n\n%s>", self.class.name, @wsdl.name, __id__, dump_method_signatures)
end