Invocation interceptors provide a means to execute custom code before and after method invocations on ActionWebService::Base objects.

When running in Direct dispatching mode, ActionController filters should be used for this functionality instead.

The semantics of invocation interceptors are the same as ActionController filters, and accept the same parameters and options.

A before interceptor can also cancel execution by returning false, or returning a [false, "cancel reason"] array if it wishes to supply a reason for canceling the request.

Example

  class CustomService < ActionWebService::Base
    before_invocation :intercept_add, :only => [:add]

    def add(a, b)
      a + b
    end

    private
      def intercept_add
        return [false, "permission denied"] # cancel it
      end
  end

Options:

:except
A list of methods for which the interceptor will NOT be called
:only
A list of methods for which the interceptor WILL be called
Methods
Public Instance methods
after_invocation(*interceptors, &block)
append_after_invocation(*interceptors, &block)

Appends the given interceptors to be called after method invocation.

This method is also aliased as after_invocation
    # File vendor/rails/actionwebservice/lib/action_web_service/invocation.rb, line 66
66:       def append_after_invocation(*interceptors, &block)
67:         conditions = extract_conditions!(interceptors)
68:         interceptors << block if block_given?
69:         add_interception_conditions(interceptors, conditions)
70:         append_interceptors_to_chain("after", interceptors)
71:       end
append_before_invocation(*interceptors, &block)

Appends the given interceptors to be called before method invocation.

This method is also aliased as before_invocation
    # File vendor/rails/actionwebservice/lib/action_web_service/invocation.rb, line 46
46:       def append_before_invocation(*interceptors, &block)
47:         conditions = extract_conditions!(interceptors)
48:         interceptors << block if block_given?
49:         add_interception_conditions(interceptors, conditions)
50:         append_interceptors_to_chain("before", interceptors)
51:       end
before_invocation(*interceptors, &block)
prepend_after_invocation(*interceptors, &block)

Prepends the given interceptors to be called after method invocation.

    # File vendor/rails/actionwebservice/lib/action_web_service/invocation.rb, line 75
75:       def prepend_after_invocation(*interceptors, &block)
76:         conditions = extract_conditions!(interceptors)
77:         interceptors << block if block_given?
78:         add_interception_conditions(interceptors, conditions)
79:         prepend_interceptors_to_chain("after", interceptors)
80:       end
prepend_before_invocation(*interceptors, &block)

Prepends the given interceptors to be called before method invocation.

    # File vendor/rails/actionwebservice/lib/action_web_service/invocation.rb, line 55
55:       def prepend_before_invocation(*interceptors, &block)
56:         conditions = extract_conditions!(interceptors)
57:         interceptors << block if block_given?
58:         add_interception_conditions(interceptors, conditions)
59:         prepend_interceptors_to_chain("before", interceptors)
60:       end