Class: SOAP::RPC::HTTPServer

Inherits:
Logger::Application
  • Object
show all
Includes:
AttrProxy
Defined in:
lib/soap/rpc/httpserver.rb

Direct Known Subclasses

StandaloneServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AttrProxy

included

Constructor Details

#initialize(config) ⇒ HTTPServer

Returns a new instance of HTTPServer.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/soap/rpc/httpserver.rb', line 31

def initialize(config)
  actor = config[:SOAPHTTPServerApplicationName] || self.class.name
  super(actor)
  @default_namespace = config[:SOAPDefaultNamespace]
  @webrick_config = config.dup
  self.level = Logger::Severity::ERROR # keep silent by default
  @webrick_config[:Logger] ||= @log
  @log = @webrick_config[:Logger]     # sync logger of App and HTTPServer
  @router = ::SOAP::RPC::Router.new(actor)
  @soaplet = ::SOAP::RPC::SOAPlet.new(@router)
  on_init
  @server = WEBrick::HTTPServer.new(@webrick_config)
  @server.mount('/soaprouter', @soaplet)
  if wsdldir = config[:WSDLDocumentDirectory]
    @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir)
  end
  @server.mount('/', @soaplet)
end

Instance Attribute Details

#default_namespaceObject

Returns the value of attribute default_namespace.



24
25
26
# File 'lib/soap/rpc/httpserver.rb', line 24

def default_namespace
  @default_namespace
end

#serverObject (readonly)

Returns the value of attribute server.



23
24
25
# File 'lib/soap/rpc/httpserver.rb', line 23

def server
  @server
end

Instance Method Details

#add_document_method(obj, soapaction, name, req_qnames, res_qnames) ⇒ Object



108
109
110
111
# File 'lib/soap/rpc/httpserver.rb', line 108

def add_document_method(obj, soapaction, name, req_qnames, res_qnames)
  param_def = SOAPMethod.create_doc_param_def(req_qnames, res_qnames)
  @router.add_document_operation(obj, soapaction, name, param_def)
end

#add_document_operation(receiver, soapaction, name, param_def, opt = {}) ⇒ Object



121
122
123
# File 'lib/soap/rpc/httpserver.rb', line 121

def add_document_operation(receiver, soapaction, name, param_def, opt = {})
  @router.add_document_operation(receiver, soapaction, name, param_def, opt)
end

#add_document_request_operation(factory, soapaction, name, param_def, opt = {}) ⇒ Object



125
126
127
# File 'lib/soap/rpc/httpserver.rb', line 125

def add_document_request_operation(factory, soapaction, name, param_def, opt = {})
  @router.add_document_request_operation(factory, soapaction, name, param_def, opt)
end

#add_headerhandler(obj) ⇒ Object Also known as: add_rpc_headerhandler



84
85
86
# File 'lib/soap/rpc/httpserver.rb', line 84

def add_headerhandler(obj)
  @router.add_headerhandler(obj)
end

#add_request_headerhandler(factory) ⇒ Object



80
81
82
# File 'lib/soap/rpc/httpserver.rb', line 80

def add_request_headerhandler(factory)
  @router.add_request_headerhandler(factory)
end

#add_rpc_method(obj, name, *param) ⇒ Object Also known as: add_method

method entry interface



95
96
97
# File 'lib/soap/rpc/httpserver.rb', line 95

def add_rpc_method(obj, name, *param)
  add_rpc_method_as(obj, name, name, *param)
end

#add_rpc_method_as(obj, name, name_as, *param) ⇒ Object Also known as: add_method_as



100
101
102
103
104
105
# File 'lib/soap/rpc/httpserver.rb', line 100

def add_rpc_method_as(obj, name, name_as, *param)
  qname = XSD::QName.new(@default_namespace, name_as)
  soapaction = nil
  param_def = SOAPMethod.derive_rpc_param_def(obj, name, *param)
  @router.add_rpc_operation(obj, qname, soapaction, name, param_def)
end

#add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {}) ⇒ Object



113
114
115
# File 'lib/soap/rpc/httpserver.rb', line 113

def add_rpc_operation(receiver, qname, soapaction, name, param_def, opt = {})
  @router.add_rpc_operation(receiver, qname, soapaction, name, param_def, opt)
end

#add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {}) ⇒ Object



117
118
119
# File 'lib/soap/rpc/httpserver.rb', line 117

def add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt = {})
  @router.add_rpc_request_operation(factory, qname, soapaction, name, param_def, opt)
end

#add_rpc_request_servant(factory, namespace = @default_namespace) ⇒ Object

servant entry interface



72
73
74
# File 'lib/soap/rpc/httpserver.rb', line 72

def add_rpc_request_servant(factory, namespace = @default_namespace)
  @router.add_rpc_request_servant(factory, namespace)
end

#add_rpc_servant(obj, namespace = @default_namespace) ⇒ Object



76
77
78
# File 'lib/soap/rpc/httpserver.rb', line 76

def add_rpc_servant(obj, namespace = @default_namespace)
  @router.add_rpc_servant(obj, namespace)
end

#authenticatorObject



62
63
64
# File 'lib/soap/rpc/httpserver.rb', line 62

def authenticator
  @soaplet.authenticator
end

#authenticator=(authenticator) ⇒ Object



66
67
68
# File 'lib/soap/rpc/httpserver.rb', line 66

def authenticator=(authenticator)
  @soaplet.authenticator = authenticator
end

#filterchainObject



89
90
91
# File 'lib/soap/rpc/httpserver.rb', line 89

def filterchain
  @router.filterchain
end

#on_initObject



50
51
52
# File 'lib/soap/rpc/httpserver.rb', line 50

def on_init
  # do extra initialization in a derived class if needed.
end

#shutdownObject



58
59
60
# File 'lib/soap/rpc/httpserver.rb', line 58

def shutdown
  @server.shutdown if @server
end

#statusObject



54
55
56
# File 'lib/soap/rpc/httpserver.rb', line 54

def status
  @server.status if @server
end