Class | ActionWebService::Client::Soap |
In: |
vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb
|
Parent: | Base |
Implements SOAP client support (using RPC encoding for the messages).
class PersonAPI < ActionWebService::API::Base api_method :find_all, :returns => [[Person]] end soap_client = ActionWebService::Client::Soap.new(PersonAPI, "http://...") persons = soap_client.find_all
Creates a new web service client using the SOAP RPC protocol.
api must be an ActionWebService::API::Base derivative, and endpoint_uri must point at the relevant URL to which protocol requests will be sent with HTTP POST.
Valid options:
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)
# File vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb, line 44 44: def initialize(api, endpoint_uri, options={}) 45: super(api, endpoint_uri) 46: @namespace = options[:namespace] || 'urn:ActionWebService' 47: @driver_options = options[:driver_options] || {} 48: @protocol = ActionWebService::Protocol::Soap::SoapProtocol.new @namespace 49: @soap_action_base = options[:soap_action_base] 50: @soap_action_base ||= URI.parse(endpoint_uri).path 51: @driver = create_soap_rpc_driver(api, endpoint_uri) 52: @driver_options.each do |name, value| 53: @driver.options[name.to_s] = value 54: end 55: end
# File vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb, line 58 58: def perform_invocation(method_name, args) 59: method = @api.api_methods[method_name.to_sym] 60: args = method.cast_expects(args.dup) rescue args 61: return_value = @driver.send(method_name, *args) 62: method.cast_returns(return_value.dup) rescue return_value 63: end