[erlang-questions] json-rpc erlang adding new procedure/ method

mark markkicks@REDACTED
Tue Jul 29 04:28:05 CEST 2008

I am trying to get json-rpc working in erlang, and got the
test_jsonrpc_inets example working. from here

I am trying to add another procedure new_proc similar to test_proc,
and if I add these two lines to the test_jsonrpc_inets.erl, it does
not work, and it says method not supported on my rpc client.
can you tell me what is the correct way to add another procedure?

handle_call({jsonrpc, <<"test_proc">>, _ModData, [Value]}, _From, State) ->
    {reply, {result, <<"ErlangServer: ", Value/binary>>}, State};
handle_call({jsonrpc, <<"new_proc">>, _ModData, [Value]}, _From, State) ->
    {reply, {result, <<"NewMessage: ", Value/binary>>}, State}.

error from my json-rpc client.
>>> s.test_proc("hello")
{u'version': u'1.1', u'id': 5, u'result': u'ErlangServer: hello'}
>>> s.new_proc("hello")
{u'version': u'1.1', u'id': 6, u'error': {u'message': u'Procedure not
found', u'code': 404, u'name': u'JSONRPCError', u'error':
[u'http://localhost:5671/rpc/test', u'new_proc']}}

More information about the erlang-questions mailing list