1- require 'nori'
2-
31module WashOut
42 # The WashOut::Dispatcher module should be included in a controller acting
53 # as a SOAP endpoint. It includes actions for generating WSDL and handling
@@ -10,28 +8,10 @@ module Dispatcher
108 class SOAPError < Exception ; end
119 class ProgrammerError < Exception ; end
1210
13- # This filter parses the SOAP request and puts it into +params+ array.
14- def _parse_soap_parameters
15-
16- nori_parser = Nori . new (
17- :parser => soap_config . parser ,
18- :strip_namespaces => true ,
19- :advanced_typecasting => true ,
20- :convert_tags_to => ( soap_config . snakecase_input ? lambda { |tag | tag . snakecase . to_sym } : lambda { |tag | tag . to_sym } ) )
21-
22- @_params = nori_parser . parse ( request . raw_post )
23- references = WashOut ::Dispatcher . deep_select ( @_params ) { |k , v | v . is_a? ( Hash ) && v . has_key? ( :@id ) }
24-
25- unless references . blank?
26- replaces = { } ; references . each { |r | replaces [ '#' +r [ :@id ] ] = r }
27- @_params = WashOut ::Dispatcher . deep_replace_href ( @_params , replaces )
28- end
29- end
30-
3111 def _authenticate_wsse
3212
3313 begin
34- xml_security = @_params . values_at ( :envelope , :Envelope ) . compact . first
14+ xml_security = env [ 'wash_out.soap_data' ] . values_at ( :envelope , :Envelope ) . compact . first
3515 xml_security = xml_security . values_at ( :header , :Header ) . compact . first
3616 xml_security = xml_security . values_at ( :security , :Security ) . compact . first
3717 username_token = xml_security . values_at ( :username_token , :UsernameToken ) . compact . first
@@ -49,7 +29,7 @@ def _map_soap_parameters
4929 soap_action = request . env [ 'wash_out.soap_action' ]
5030 action_spec = self . class . soap_actions [ soap_action ]
5131
52- xml_data = @_params . values_at ( :envelope , :Envelope ) . compact . first
32+ xml_data = env [ 'wash_out.soap_data' ] . values_at ( :envelope , :Envelope ) . compact . first
5333 xml_data = xml_data . values_at ( :body , :Body ) . compact . first
5434 xml_data = xml_data . values_at ( soap_action . underscore . to_sym ,
5535 soap_action . to_sym ) . compact . first || { }
@@ -176,8 +156,6 @@ def render_soap_error(message)
176156 def self . included ( controller )
177157 controller . send :rescue_from , SOAPError , :with => :_render_soap_exception
178158 controller . send :helper , :wash_out
179- controller . send :before_filter , :_parse_soap_parameters , :except => [
180- :_generate_wsdl , :_invalid_action ]
181159 controller . send :before_filter , :_authenticate_wsse , :except => [
182160 :_generate_wsdl , :_invalid_action ]
183161 controller . send :before_filter , :_map_soap_parameters , :except => [
0 commit comments