Re: [Json-rpc-java] how to hanle response with 2 diffrent type

15 views
Skip to first unread message

Sasha O

unread,
May 27, 2010, 10:34:42 AM5/27/10
to jabsorb-user, json-r...@oss.metaparadigm.com
Victor --

The easiest way to return error object would be to throw exception
within the server-side implementation. Then this exception would be
wrapped in the JSON response and can be available on the client side.

Regards,
-- Sasha

P.S. I think 'jabsorb-user' is the better place to ask.

On 5/27/10 3:17 AM, Victor Y. Sklyar wrote:
> Hi, Json-rpc-java community!
>
> I have such jsonrpc server with can reply to request with 2 different
> type, see bellow example
>
> foo(string s) return bool false if some error condition, or(!) string
> if successfull
>
> my question is simple - how to handle this request?
>
>
> HTTPSession.register(TransportRegistry.i());
> HTTPSession httpSession= (HTTPSession)TransportRegistry.i().createSession(rootURL);
> HttpState state= new HttpState();
> httpSession.setState(state);
> org.codebistro.jsonrpc.Client jsonrpc_client= new org.codebistro.jsonrpc.Client(httpSession);
> RpcIF rpc = jsonrpc_client.openProxy(null, RpcIF.class);
> String s = "bla-bla";
>
> Object obj = rpc.foo(sid);
>
>
> but i receive
>
>

Reply all
Reply to author
Forward
0 new messages