class
Importance_2
Ruby latest stable (v2_5_5) - 0 notes - Superclass: WEBrickServlet

Class deprecated or moved

This class is deprecated or moved on the latest stable version. The last existing version (v2_2_9) is shown here.

Implements a standalone XML-RPC server. The method XMLRPC::Server#serve is left if a SIGHUP is sent to the program.

 require "xmlrpc/server"

s = XMLRPC::Server.new(8080)

s.add_handler("michael.add") do |a,b|
  a + b
end

s.add_handler("michael.div") do |a,b|
  if b == 0
    raise XMLRPC::FaultException.new(1, "division by zero")
  else
    a / b
  end
end

s.set_default_handler do |name, *args|
  raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
                                   " or wrong number of parameters!")
end

s.serve
Show files where this class is defined (1 file)
Register or log in to add new notes.