Class: ActionWebService::Client::Soap

Inherits:
Base
  • Object
show all
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 Method Summary collapse

Methods inherited from Base

#method_missing

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:

:service_name

If the remote server has used a custom wsdl_service_name option, you must specify it here



29
30
31
32
33
34
35
36
37
38
# File 'lib/action_web_service/client/soap_client.rb', line 29

def initialize(api, endpoint_uri, options={})
  super(api, endpoint_uri)
  @service_name = options[:service_name] || 'ActionWebService'
  @namespace = "urn:#{@service_name}" 
  @mapper = ActionWebService::Protocol::Soap::SoapMapper.new(@namespace)
  @protocol = ActionWebService::Protocol::Soap::SoapProtocol.new(@mapper)
  @soap_action_base = options[:soap_action_base]
  @soap_action_base ||= URI.parse(endpoint_uri).path
  @driver = create_soap_rpc_driver(api, endpoint_uri)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActionWebService::Client::Base