Sha256: d5e7d711090f6d7d1f41f2751bc6bd958cc450cb0af65f23cd9ffaf852b93632
Contents?: true
Size: 930 Bytes
Versions: 6
Compression:
Stored size: 930 Bytes
Contents
module WashOut # This class is a Rack middleware used to route SOAP requests to a proper # action of a given SOAP controller. class Router def initialize(controller_name) @controller_name = "#{controller_name.to_s}_controller".camelize end def call(env) controller = @controller_name.constantize if soap_action = env['HTTP_SOAPACTION'] # RUBY18 1.8 does not have force_encoding. soap_action.force_encoding('UTF-8') if soap_action.respond_to? :force_encoding namespace = Regexp.escape WashOut::Engine.namespace.to_s soap_action.gsub!(/^\"(namespace\/?)?(.*)\"$/, '\2') env['wash_out.soap_action'] = soap_action end action_spec = controller.soap_actions[soap_action] if action_spec action = action_spec[:to] else action = '_invalid_action' end controller.action(action).call(env) end end end
Version data entries
6 entries across 6 versions & 1 rubygems