Class: ActionWebService::Client::Soap
- Defined in:
- lib/action_web_service/client/soap_client.rb
Overview
Implements SOAP client support (using RPC encoding for the messages).
Example Usage
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
Defined Under Namespace
Classes: SoapDriver
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
provides access to the underlying soap driver.
Instance Method Summary collapse
-
#initialize(api, endpoint_uri, options = {}) ⇒ Soap
constructor
Creates a new web service client using the SOAP RPC protocol.
Methods inherited from Base
Constructor Details
#initialize(api, endpoint_uri, options = {}) ⇒ Soap
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:
:namespace
-
If the remote server has used a custom namespace to declare its custom types, you can specify it here. This would be the namespace declared with a [WebService(Namespace = “namespace”)] attribute in .NET, for example.
: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)
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/action_web_service/client/soap_client.rb', line 46 def initialize(api, endpoint_uri, ={}) super(api, endpoint_uri) @namespace = [:namespace] || 'urn:ActionWebService' @driver_options = [:driver_options] || {} @protocol = ActionWebService::Protocol::Soap::SoapProtocol.new @namespace @soap_action_base = [: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.[name.to_s] = value end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActionWebService::Client::Base
Instance Attribute Details
#driver ⇒ Object (readonly)
provides access to the underlying soap driver
20 21 22 |
# File 'lib/action_web_service/client/soap_client.rb', line 20 def driver @driver end |