From 9b83e3396180d0dbcb23ec3d71adb198eae7629b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 21 Nov 2007 15:17:04 +0000 Subject: Ousted ActionWebService from Rails 2.0 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8180 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_web_service/client/xmlrpc_client.rb | 58 ---------------------- 1 file changed, 58 deletions(-) delete mode 100644 actionwebservice/lib/action_web_service/client/xmlrpc_client.rb (limited to 'actionwebservice/lib/action_web_service/client/xmlrpc_client.rb') diff --git a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb b/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb deleted file mode 100644 index 42b5c5d4f9..0000000000 --- a/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +++ /dev/null @@ -1,58 +0,0 @@ -require 'uri' -require 'xmlrpc/client' - -module ActionWebService # :nodoc: - module Client # :nodoc: - - # 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 - class XmlRpc < Base - - # 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 - 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 - - protected - def perform_invocation(method_name, args) - method = @api.api_methods[method_name.to_sym] - if method.expects && method.expects.length != args.length - raise(ArgumentError, "#{method.public_name}: wrong number of arguments (#{args.length} for #{method.expects.length})") - end - args = method.cast_expects(args.dup) rescue args - if method.expects - method.expects.each_with_index{ |type, i| args[i] = @protocol.value_to_xmlrpc_wire_format(args[i], type) } - end - ok, return_value = @client.call2(public_name(method_name), *args) - return (method.cast_returns(return_value.dup) rescue return_value) if ok - raise(ClientError, "#{return_value.faultCode}: #{return_value.faultString}") - end - - def public_name(method_name) - public_name = @api.public_api_method_name(method_name) - @handler_name ? "#{@handler_name}.#{public_name}" : public_name - end - end - end -end -- cgit v1.2.3