2 # Marshalling of XML-RPC methodCall and methodResponse
4 # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
6 # $Id: marshal.rb 11708 2007-02-12 23:01:19Z shyouhei $
9 require "xmlrpc/parser"
10 require "xmlrpc/create"
11 require "xmlrpc/config"
12 require "xmlrpc/utils"
17 include ParserWriterChooseMixin
19 # class methods -------------------------------
23 def dump_call( methodName, *params )
24 new.dump_call( methodName, *params )
27 def dump_response( param )
28 new.dump_response( param )
31 def load_call( stringOrReadable )
32 new.load_call( stringOrReadable )
35 def load_response( stringOrReadable )
36 new.load_response( stringOrReadable )
39 alias dump dump_response
40 alias load load_response
44 # instance methods ----------------------------
46 def initialize( parser = nil, writer = nil )
51 def dump_call( methodName, *params )
52 create.methodCall( methodName, *params )
55 def dump_response( param )
56 create.methodResponse( ! param.kind_of?( XMLRPC::FaultException ) , param )
60 # returns [ methodname, params ]
62 def load_call( stringOrReadable )
63 parser.parseMethodCall( stringOrReadable )
67 # returns paramOrFault
69 def load_response( stringOrReadable )
70 parser.parseMethodResponse( stringOrReadable )[1]