Permalink
Browse files

allow the client to specify options to be passed through to the under…

…lying

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
  • Loading branch information...
1 parent 631340d commit e834be75bcbbece8970abad221f21411c5b93a96 @leonbreedt leonbreedt committed Mar 3, 2005
Showing with 17 additions and 0 deletions.
  1. +17 −0 actionwebservice/lib/action_web_service/client/soap_client.rb
@@ -28,15 +28,32 @@ class Soap < Base
# declare its custom types, you can specify it here
# [<tt>:method_namespace</tt>] If the remote server has used a custom namespace to
# declare its methods, you can specify it here
+ # [<tt>:driver_options</tt>] If you want to supply any custom SOAP RPC driver
+ # options, you can provide them as a Hash here
+ #
+ # The <tt>:driver_options</tt> 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

0 comments on commit e834be7

Please sign in to comment.