I thought this could be helpful for some folks looking for help here.
It shows how to modify an outgoing request/response, the header as
well as the body:
# Client request (outbound) #
class ClientOutboundFilter < ::SOAP::Filter::StreamHandler
def on_http_outbound(req)
# working with the final http request
req.body.set_content(req.body.content.gsub(/foo/, 'bar'))
end
end
obj = My_SOAP_RPC_Driver.new('
http://example.com/my_url')
# add custom filter
obj.streamhandler.filterchain.add(ClientOutboundFilter.new)
request = MyRequest.new('some content')
response = obj.my_method(request)
# Server response (outbound, in Rails) #
class MySOAPController < ApplicationController
after_filter :modify_response
def modify_response
# working with the final http request
response.body.gsub!(/foo/, 'bar')
end
end