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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:50:08+00:00 2026-06-04T00:50:08+00:00

I’m getting a JSON string from a WCF service but I’m getting issues sometimes

  • 0

I’m getting a JSON string from a WCF service but I’m getting issues sometimes and sometimes it works fine. It’s weird because the results that are getting returned should be exactly the same but sometimes it works fine, and other times I need to hit refresh in my application a couple times and it works fine. So i’m not sure if there is an inconstancy with something in my JSON string or if anyone has any ideas. Here is the JSON string that is being returned

[{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"3\/30\/2012 3:19:00 PM","iAssessmentID":1,"iAssessmentType":2,"sAssmtName":"Weekly Skin"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":4,"sAssmtName":"Admission Skin"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":5,"sAssmtName":"PHQ - 9 - Resident"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":6,"sAssmtName":"PHQ - 9 - Staff"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":7,"sAssmtName":"Brief Interview for Metal Status (BIMS)"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":8,"sAssmtName":"Staff Assessment for Mental Status"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":1001,"sAssmtName":"Open Note"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":1002,"sAssmtName":"Labs Test"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"1\/1\/1900","iAssessmentID":1,"iAssessmentType":1003,"sAssmtName":"Smoking Assessment"},{"AssmtStatus":1,"AssmtStatusText":null,"CreatedBy":"","IntervalDescr":null,"Status":0,"WoundLocation":null,"dtAssmtDate":"1\/1\/1900","dtLastCompleted":"5\/7\/2012 9:15:00 AM","iAssessmentID":1,"iAssessmentType":1004,"sAssmtName":"Inquiry Assessment"}]

the error i get is “Unterminated string at character 2431” if anyone has any ideas, i would really appreciate the help. thanks

EDIT: Here is the entire class I’m using to get the JSON.

private class GetAssmts extends AsyncTask<String,Void,Void>{
     private ProgressDialog Dialog = new ProgressDialog(AssmtSelectionUnScheduled.this);

     protected void onPreExecute(){
         Dialog.setMessage("Loading..");
         Dialog.show();
     }

    @Override
    protected Void doInBackground(String... params) {
        try {
            HttpGet request = new HttpGet(SERVICE_URL + "/GetAssmtsUnScheduled/" + FacID + "/" + ResID + "/" + UserID);
            request.setHeader("Accept", "application/json");
            request.setHeader("Content-type", "application/json");

            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpResponse response = httpClient.execute(request);

            HttpEntity responseEntity = response.getEntity();

            // Read response data into buffer
            char[] buffer = new char[(int)responseEntity.getContentLength()];
            InputStream stream = responseEntity.getContent();
            InputStreamReader reader = new InputStreamReader(stream);
            reader.read(buffer);
            stream.close();

            JSONArray plates = new JSONArray(new String(buffer));
            MyAssmts.clear();
            for (int i = 0; i < plates.length(); ++i) {
                JSONObject jo = (JSONObject) plates.get(i);
                Assmt myassmt = new Assmt(Integer.parseInt(jo.getString("iAssessmentType")),Integer.parseInt(jo.getString("iAssessmentID")),jo.getString("sAssmtName"),jo.getString("dtLastCompleted"),
                        Integer.parseInt(jo.getString("Status")),jo.getString("WoundLocation"),jo.getString("IntervalDescr"),jo.getString("CreatedBy"),Integer.parseInt(jo.getString("AssmtStatus")),
                        jo.getString("AssmtStatusText"),jo.getString("dtAssmtDate"));
                MyAssmts.add(myassmt);
            }  
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e){
            e.printStackTrace();
        } catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    protected void onPostExecute(Void unused){
        Dialog.dismiss();
            final GridView lv = (GridView) AssmtSelectionUnScheduled.this.findViewById(R.id.gridView_AssmtList);
            lv.setAdapter(new MyAdapter(AssmtSelectionUnScheduled.this, MyAssmts));
            lv.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {
                    Assmt sel = (Assmt) (lv.getItemAtPosition(arg2));   
                    boolean isNewAssmt = true;
                    if(sel.getsCreatedBy().length() > 0 && sel.getsCreatedBy().toUpperCase().equals(UserID.toUpperCase())){
                        isNewAssmt = false;
                    }
                    launchAssmt(sel.getiAssessmentType(), sel.getiAssessmentID(), isNewAssmt, sel.getsAssmtDate());
                }
            });
        }
}
  • 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-04T00:50:10+00:00Added an answer on June 4, 2026 at 12:50 am

    My guess would be that responseEntity.getContentLength() is not returning the right value, so your character buffer ends up being too small.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a French site that I want to parse, but am running into

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.