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.


31
32
33
34
35
36
37
# File 'lib/soap/wsdlDriver.rb', line 31

def initialize(wsdl)
  @wsdl = import(wsdl)
  name_creator = WSDL::SOAP::ClassNameCreator.new
  @modulepath = 'WSDLDriverFactory'
  @methoddefcreator =
    WSDL::SOAP::MethodDefCreator.new(@wsdl, name_creator, @modulepath, {})
end

Instance Attribute Details

#wsdlObject (readonly)

Returns the value of attribute wsdl


29
30
31
# File 'lib/soap/wsdlDriver.rb', line 29

def wsdl
  @wsdl
end

Instance Method Details

#create_driver(servicename = nil, portname = nil) ⇒ Object Also known as: createDriver

deprecated old interface


52
53
54
55
56
# File 'lib/soap/wsdlDriver.rb', line 52

def create_driver(servicename = nil, portname = nil)
  warn("WSDLDriverFactory#create_driver is deprecated.  Use create_rpc_driver instead.")
  port = find_port(servicename, portname)
  WSDLDriver.new(@wsdl, port, nil)
end

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


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

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

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


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

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
      sig << port.porttype.operations.collect { |operation|
        dump_method_signature(operation, element_definitions).gsub(/^#/, ' ')
      }.join("\n")
    end
  end
  sig.join("\n")
end

#inspectObject


39
40
41
# File 'lib/soap/wsdlDriver.rb', line 39

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