Providing XML-RPC service from ruby ​​on rails application?

I am considering providing an XML-RPC service from an existing ruby ​​on rails application. I hope that I can do this by simply implementing some additional controller methods and serving it through the existing apache / passenger setting. Is this approach believable or does XML-RPC require a separate web server?

+2
source share
1 answer

Assuming Rails 3:

There are two or three basic approaches to providing XMLRPC services from a rails application.

- Rack (gem 'rack-rpc' - https://github.com/datagraph/rack-rpc), , , , , , ActiveRecord. rack-rpc xml-rpc, application.rb, , ActiveRecord.

, rails 1.x days. , Rails 3.0.5:

gem 'rubyjedi-soap4r'
gem 'actionwebservice', :git => 'https://github.com/mkoentopf/actionwebservice.git'

actionwebservice , API RESTful -, , , xmlrpc (, , ), , , .

, ApiController :

class ApiController < ApplicationController
  acts_as_web_service
  web_service_dispatching_mode :layered

  skip_before_filter :your_default_auth_method

  web_service :metaWeblog, MetaweblogService.new(self)
  web_service :blogger, BloggerService.new(self)
...

  def xmlrpc
    api
  end

  def api
    dispatch_web_service_request
  end

end

Api Service. ( , "metaWeblog.methname" "metaWeblog.methodname" xml-rpc, , actionwebservice.

MyApi ActionWebService:: API:: Base , api_method, xml-rpc. MyService ActionWebService:: Base , . , / ApiController, , .

+2

Source: https://habr.com/ru/post/1744650/


All Articles