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 8957629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:02:16+00:00 2026-06-15T15:02:16+00:00

My Application makes calls to our server through a couple different Asynctask ‘s, it

  • 0

My Application makes calls to our server through a couple different Asynctask‘s, it pulls data twice and finally sends a JSONArray through POST.

It had been working properly but recently stopped, no changes were made. Here is my AsyncTask to POST a JSONArray with only the necessary information:

UPDATED JAVA

String inString;
JSONObject realjObject;
JSONArray compJArray;
int completeCount = 0;
URL url;
@Override
protected Void doInBackground(JSONArray... jsonArray) {
    if(jsonArray.length > 0) {
        compJArray = jsonArray[0];
    }
    completeCount = compJArray.length();

    //String url_select = "http://www.myDomain.com/db/completedSurvey.php";
    HttpResponse response;

    for (int i = 0; i < completeCount; i++) {
        try {
            realjObject = compJArray.getJSONObject(i);
            Log.i("realjObject", realjObject.toString());
            try {

                url = new URL("http://www.myDomain.com/db/completedSurvey.php");
                HttpPost httpPost = new HttpPost(url.toURI());
                HttpClient httpClient = new DefaultHttpClient();
                httpPost.setEntity(new StringEntity(realjObject.toString(), "UTF-8"));
                httpPost.setHeader(HTTP.DEFAULT_CONTENT_TYPE, "application/json");
                response = (HttpResponse) httpClient.execute(httpPost);

                BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
                StringBuilder builder = new StringBuilder();
                for (String line = null; (line = reader.readLine()) != null;) {
                    builder.append(line).append("\n");
                }

                inString = builder.toString();
                Log.w("RESPONSE", inString);

            } catch (UnsupportedEncodingException e1) { Log.e("UnsupportedEncodingException", e1.toString());
            } catch (ClientProtocolException e2) { Log.e("ClientProtocolException", e2.toString());
            } catch (IllegalStateException e3) { Log.e("IllegalStateException", e3.toString());
            } catch (IOException e4) { Log.e("IOException", e4.toString());
            } catch (URISyntaxException e) {Log.e("URISyntaxException", "" + e.getMessage());
            }

        } catch (JSONException e) { Log.e("doInBackground", "JSONException: " + e.getMessage());
        }
    }
    return null;
}

And here is how I am receiving the code, PHP-Server side:

require("../logger/logging.class.php");

$genLog->lwrite("Is Android accessing this url?");
$json = file_get_contents('php://input');

$genLog->lwrite($json);

if ($json) {
    // Parse JSONArray, was working properly
}

My log is writing perfectly fine if the I access the url through the browser, however nothing is written when running the application. I have tested all output in the AsyncTask and everything seems to work properly.


LogCat output of realjObject (Verified on http://www.jsonlint.com):

{
    "Notes": "null",
    "SurveyPhoto": "null",
    "id": 2,
    "siteNotes": "",
    "loc_id": 1,
    "sign_type": "FREESTANDING SIGN",
    "Lighting": 0,
    "AdditionalService": 0,
    "view_id": 2,
    "survey_order": 1
}

Edit

I just started thinking that my require("../logger/logging.class.php"); might conflict with $json = file_get_contents('php://input');, but I just commented out all of my logging and require lines and it still isn’t doing anything.

Device has internet connection and has an established connection with this MySQL database or I wouldn’t get a point of being able to submit the JSONArray.

Test Device: Samsung Galaxy Tab 10.1 Gen 1 running Android 4.0.1

Edit 2

I fixed the InputStream to give me a response and got the following 404 & 406 response:

12-05 09:31:39.345: W/RESPONSE(19023): <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
12-05 09:31:39.345: W/RESPONSE(19023): <html><head>
12-05 09:31:39.345: W/RESPONSE(19023): <title>406 Not Acceptable</title>
12-05 09:31:39.345: W/RESPONSE(19023): </head><body>
12-05 09:31:39.345: W/RESPONSE(19023): <h1>Not Acceptable</h1>
12-05 09:31:39.345: W/RESPONSE(19023): <p>An appropriate representation of the requested resource /db/completeSurvey.php could not be found on this server.</p>
12-05 09:31:39.345: W/RESPONSE(19023): <p>Additionally, a 404 Not Found
12-05 09:31:39.345: W/RESPONSE(19023): error was encountered while trying to use an ErrorDocument to handle the request.</p>
12-05 09:31:39.345: W/RESPONSE(19023): <hr>
12-05 09:31:39.345: W/RESPONSE(19023): <address>Apache Server at www.myDomain.com Port 80</address>
12-05 09:31:39.345: W/RESPONSE(19023): </body></html>

What could suddenly cause this?

EDIT 3 – Recent steps I took to troubleshoot:

  1. I have contacted our web host and they are telling me everything on their end is fine.
    The server logs (error_log) don’t show any errors
  2. I have slightly changed the above Java to show my response return as well as changing to using URL class rather then String for the new HttpPost(url.toURI());. LogCat shows the correct domain, copied and pasted into browser, works fine.
  3. I have changed the URL to another file with the /db/completeSurvey.php contents placed into the new file, same 404/406 response as above.
  4. I created another new php file only containing an fwrite to log page call, same 404/406 response as above.
  5. I directed to our root domain, “http://www.myDomain.com&#8221;, same 404/406 response as above

I’m starting to think that it has to be either the device or my code.

  • 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-15T15:02:18+00:00Added an answer on June 15, 2026 at 3:02 pm

    I contacted our Web Host (Surpass Hosting) and gave them the following message:

    406 Not Acceptable

    An appropriate representation of the requested resource /db/completedSurvey.php could not be found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Apache Server at http://www.myDomain.com Port 80

    At first they said that I needed to write more logging code to determine what the cause was because it wasn’t on their end.

    Eventually I finally got sent to Tech Support Level II, the guy there gave me the answer immediately:


    Solution:

    Surpass Tech:
    “This was due to the script matching a rule in mod_security. I’ve disabled only this rule for that file.”

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

Sidebar

Related Questions

So we have an application that makes udp calls and sends packets. However, since
I have an asp.net MVC3 application that makes Ajax calls to the server on
My application makes several calls to an Action method (ASP .NET MVC) which returns
I am looking at an asp.net application that makes calls to a database within
We're currently using IIS 6 and Windows Server 2003 for our web and application
I'm working on an application for one of our departments that contains medical data.
I have a WCF service and a Web application. Web application makes calls to
In our client / server application, the server side is exposed by a collection
I have an server application (running as a Windows Service) that receives calls from
We are converting our application from using Sql Server Express (let's call this version

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.