Class: ActionWebService::Client::XmlRpc

Inherits:
Base
  • Object
show all
Defined in:
lib/action_web_service/client/xmlrpc_client.rb

Overview

Implements XML-RPC client support

Example Usage

class BloggerAPI < ActionWebService::API::Base
  inflect_names false
  api_method :getRecentPosts, :returns => [[Blog::Post]]
end

blog = ActionWebService::Client::XmlRpc.new(BloggerAPI, "http://.../RPC", :handler_name => "blogger")
posts = blog.getRecentPosts

Instance Method Summary collapse

Methods inherited from Base

#method_missing

Constructor Details

#initialize(api, endpoint_uri, options = {}) ⇒ XmlRpc

Creates a new web service client using the XML-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:

:handler_name

If the remote server defines its services inside special handler (the Blogger API uses a "blogger" handler name for example), provide it here, or your method calls will fail



30
31
32
33
34
35
# File 'lib/action_web_service/client/xmlrpc_client.rb', line 30

def initialize(api, endpoint_uri, options={})
  @api = api
  @handler_name = options[:handler_name]
  @protocol = ActionWebService::Protocol::XmlRpc::XmlRpcProtocol.new
  @client = XMLRPC::Client.new2(endpoint_uri, options[:proxy], options[:timeout])
end

Dynamic Method Handling

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