From e834be75bcbbece8970abad221f21411c5b93a96 Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Thu, 3 Mar 2005 21:30:44 +0000 Subject: allow the client to specify options to be passed through to the underlying SOAP::RPC::Driver. add to RDoc an example of using these options to configure SSL client-certificate authenticated connections to the server. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@826 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_web_service/client/soap_client.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'actionwebservice/lib') diff --git a/actionwebservice/lib/action_web_service/client/soap_client.rb b/actionwebservice/lib/action_web_service/client/soap_client.rb index d3975d89a2..b8a20bb40e 100644 --- a/actionwebservice/lib/action_web_service/client/soap_client.rb +++ b/actionwebservice/lib/action_web_service/client/soap_client.rb @@ -28,15 +28,32 @@ module ActionWebService # :nodoc: # declare its custom types, you can specify it here # [:method_namespace] If the remote server has used a custom namespace to # declare its methods, you can specify it here + # [:driver_options] If you want to supply any custom SOAP RPC driver + # options, you can provide them as a Hash here + # + # The :driver_options option can be used to configure the backend SOAP + # RPC driver. An example of configuring the SOAP backend to do + # client-certificate authenticated SSL connections to the server: + # + # opts = {} + # opts['protocol.http.ssl_config.verify_mode'] = 'OpenSSL::SSL::VERIFY_PEER' + # opts['protocol.http.ssl_config.client_cert'] = client_cert_file_path + # opts['protocol.http.ssl_config.client_key'] = client_key_file_path + # opts['protocol.http.ssl_config.ca_file'] = ca_cert_file_path + # client = ActionWebService::Client::Soap.new(api, 'https://some/service', :driver_options => opts) def initialize(api, endpoint_uri, options={}) super(api, endpoint_uri) @type_namespace = options[:type_namespace] || 'urn:ActionWebService' @method_namespace = options[:method_namespace] || 'urn:ActionWebService' + @driver_options = options[:driver_options] || {} @marshaler = WS::Marshaling::SoapMarshaler.new @type_namespace @encoder = WS::Encoding::SoapRpcEncoding.new @method_namespace @soap_action_base = options[:soap_action_base] @soap_action_base ||= URI.parse(endpoint_uri).path @driver = create_soap_rpc_driver(api, endpoint_uri) + @driver_options.each do |name, value| + @driver.options[name.to_s] = value.to_s + end end protected -- cgit v1.2.3