Class SOAP::WSDLDriverFactory
In: lib/soap/wsdlDriver.rb
Parent: Object

Methods

Classes and Modules

Class SOAP::WSDLDriverFactory::FactoryError

Attributes

wsdl  [R] 

Public Class methods

[Source]

    # File lib/soap/wsdlDriver.rb, line 27
27:   def initialize(wsdl)
28:     @wsdl = import(wsdl)
29:     @methoddefcreator = WSDL::SOAP::MethodDefCreator.new(@wsdl)
30:   end

Public Instance methods

createDriver(servicename = nil, portname = nil)

Alias for create_driver

depricated old interface

[Source]

    # File lib/soap/wsdlDriver.rb, line 45
45:   def create_driver(servicename = nil, portname = nil)
46:     warn("WSDLDriverFactory#create_driver is depricated.  Use create_rpc_driver instead.")
47:     port = find_port(servicename, portname)
48:     WSDLDriver.new(@wsdl, port, nil)
49:   end

[Source]

    # File lib/soap/wsdlDriver.rb, line 36
36:   def create_rpc_driver(servicename = nil, portname = nil)
37:     port = find_port(servicename, portname)
38:     drv = SOAP::RPC::Driver.new(port.soap_address.location)
39:     init_driver(drv, port)
40:     add_operation(drv, port)
41:     drv
42:   end

[Source]

    # File lib/soap/wsdlDriver.rb, line 32
32:   def inspect
33:     "#<#{self.class}:#{@wsdl.name}>"
34:   end

Private Instance methods

[Source]

     # File lib/soap/wsdlDriver.rb, line 95
 95:   def add_operation(drv, port)
 96:     port.find_binding.operations.each do |op_bind|
 97:       op_name = op_bind.soapoperation_name
 98:       soapaction = op_bind.soapaction || ''
 99:       orgname = op_name.name
100:       name = XSD::CodeGen::GenSupport.safemethodname(orgname)
101:       param_def = create_param_def(op_bind)
102:       opt = {
103:         :request_style => op_bind.soapoperation_style,
104:         :response_style => op_bind.soapoperation_style,
105:         :request_use => op_bind.input.soapbody_use,
106:         :response_use => op_bind.output.soapbody_use,
107:         :elementformdefault => false,
108:         :attributeformdefault => false
109:       }
110:       if op_bind.soapoperation_style == :rpc
111:         drv.add_rpc_operation(op_name, soapaction, name, param_def, opt)
112:       else
113:         drv.add_document_operation(soapaction, name, param_def, opt)
114:       end
115:       if orgname != name and orgname.capitalize == name.capitalize
116:         ::SOAP::Mapping.define_singleton_method(drv, orgname) do |*arg|
117:           __send__(name, *arg)
118:         end
119:       end
120:     end
121:   end

[Source]

     # File lib/soap/wsdlDriver.rb, line 127
127:   def create_param_def(op_bind)
128:     op = op_bind.find_operation
129:     if op_bind.soapoperation_style == :rpc
130:       param_def = @methoddefcreator.collect_rpcparameter(op)
131:     else
132:       param_def = @methoddefcreator.collect_documentparameter(op)
133:     end
134:     # the first element of typedef in param_def is a String like
135:     # "::SOAP::SOAPStruct".  turn this String to a class.
136:     param_def.collect { |io, name, typedef|
137:       typedef[0] = Mapping.class_from_name(typedef[0])
138:       [io, name, typedef]
139:     }
140:   end

[Source]

     # File lib/soap/wsdlDriver.rb, line 154
154:   def filter_parts(partsdef, partssource)
155:     parts = partsdef.split(/\s+/)
156:     partssource.find_all { |part| parts.include?(part.name) }
157:   end

[Source]

    # File lib/soap/wsdlDriver.rb, line 56
56:   def find_port(servicename = nil, portname = nil)
57:     service = port = nil
58:     if servicename
59:       service = @wsdl.service(
60:         XSD::QName.new(@wsdl.targetnamespace, servicename))
61:     else
62:       service = @wsdl.services[0]
63:     end
64:     if service.nil?
65:       raise FactoryError.new("service #{servicename} not found in WSDL")
66:     end
67:     if portname
68:       port = service.ports[XSD::QName.new(@wsdl.targetnamespace, portname)]
69:       if port.nil?
70:         raise FactoryError.new("port #{portname} not found in WSDL")
71:       end
72:     else
73:       port = service.ports.find { |port| !port.soap_address.nil? }
74:       if port.nil?
75:         raise FactoryError.new("no ports have soap:address")
76:       end
77:     end
78:     if port.soap_address.nil?
79:       raise FactoryError.new("soap:address element not found in WSDL")
80:     end
81:     port
82:   end

[Source]

     # File lib/soap/wsdlDriver.rb, line 123
123:   def import(location)
124:     WSDL::Importer.import(location)
125:   end

[Source]

    # File lib/soap/wsdlDriver.rb, line 84
84:   def init_driver(drv, port)
85:     wsdl_elements = @wsdl.collect_elements
86:     wsdl_types = @wsdl.collect_complextypes + @wsdl.collect_simpletypes
87:     rpc_decode_typemap = wsdl_types +
88:       @wsdl.soap_rpc_complextypes(port.find_binding)
89:     drv.proxy.mapping_registry =
90:       Mapping::WSDLEncodedRegistry.new(rpc_decode_typemap)
91:     drv.proxy.literal_mapping_registry =
92:       Mapping::WSDLLiteralRegistry.new(wsdl_types, wsdl_elements)
93:   end

[Source]

     # File lib/soap/wsdlDriver.rb, line 150
150:   def param_def(type, name, klass, partqname)
151:     [type, name, [klass, partqname.namespace, partqname.name]]
152:   end

[Source]

     # File lib/soap/wsdlDriver.rb, line 142
142:   def partqname(part)
143:     if part.type
144:       part.type
145:     else
146:       part.element
147:     end
148:   end

[Validate]