Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7951663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:37:42+00:00 2026-06-04T02:37:42+00:00

I am trying to get responses from a JSON-RPC Service on Android, I’m currently

  • 0

I am trying to get responses from a JSON-RPC Service on Android, I’m currently developing on 3.0 Honeycomb.

This is the library I am using:
http://code.google.com/p/android-json-rpc/

and I am using this JSON-RPC service page for testing:
http://www.raboof.com/projects/jayrock/demo.ashx

The connection seems to work, but I keep getting this Exception

org.alexd.jsonrpc.JSONRPCException: Invalid JSON response

I’ve tried different methods and survey pages, but I always get the same Exception. Where am I going wrong?

The relevant code is below. AsyncTask is used because since 3.0 Android doesn’t allow network connections in the main stream. Thanks in advance.

 @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    JSONHandler task = new JSONHandler();
    task.execute(new String[] {"http://www.raboof.com/projects/jayrock/demo.ashx"});    
}

private class JSONHandler extends AsyncTask<String, Void, String> {

    @Override
    protected String doInBackground(String... urls) {
        for (String url : urls) {
            JSONRPCClient client = JSONRPCClient.create(url);
            client.setConnectionTimeout(2000);
            client.setSoTimeout(2000);

            try {
                client.call("counter");
            } catch (JSONRPCException e) {
                e.printStackTrace(); //Invalid JSON Response caught here
            }
        }
        return null;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:37:44+00:00Added an answer on June 4, 2026 at 2:37 am

    I have tested your system using the last version of the library. It work great. You need to us callInt(“counter”) and it will be ok.

    There is the code I used:

    public JSONRPCClient client = JSONRPCClient.create("http://www.raboof.com/projects/jayrock/demo.ashx", JSONRPCClient.Versions.VERSION_2);
    try{
        int resInt = client.callInt("counter");
    } catch (JSONException e) {
        Log.i("JSON-RPC Client", e.toString());
    }
    

    I hope this can help.

    PS: with this new version, you use parameters send as an array, or using a JSONObject to send named parameters. This is only possible if using the version 2.0 of the JSON-RPC protocol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get a json response from google's geocoding service. I'm using
I'm trying to pull JSON data from another source by using the jquery.get method.
I am trying to parse a JSON response from a server using javascript/jquery. This
I am trying following, 1. Get response using Ajax from the users selection which
Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request,
I'm using the Newtonsoft JSON.NET package to deserialize my responses. This is a sample
I am trying to get a response from my server using restful services, I
i am trying to get only JSON response from a webservice. i am getting
I am trying to get the list of specific user`s friends from twitter. This
I am trying to parse the JSON response from Wordnik's API. This is built

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.