1

I am trying to update a Task through this code in a native android app

      Map<String,Object> fields = new HashMap<String,Object>();
        String id = "00Tw000001wvUCVEA2";
        fields.put("Subject", "A Subject" );
        try {
                RestRequest.getRequestForUpdate(getString(R.string.api_version), "Task", id, fields);
                TaskGridFragment.this.client.sendAsync(request, new AsyncRequestCallback() {
                            @Override
                            public void onSuccess(RestRequest request,
                                    RestResponse response) {
                                    System.out.println("UPDATE RESP "+response);
                            }

                            @Override
                            public void onError(Exception exception) {
                                // TODO Auto-generated method stub
                                System.out.println("UPDATE FAIL ");
                                exception.printStackTrace();
                            }
                        });
                    } catch (UnsupportedEncodingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

The problem is that I get this error

I get BasicNetwork.performRequest: Unexpected response code 400 for https://eu3.salesforce.com/services/data/v31.0/sobjects/Task/00Tw000001wvUCVEA2 why !??

  • Seems like a bug. But can you investigate the request is exact you trying to send. – Ashwani Sep 24 '14 at 10:54
  • I have changed the question, please help me :( – lowcoupling Sep 24 '14 at 10:55
  • which release you are using? – Ashwani Sep 24 '14 at 10:57
  • I guess the last : 31.0 – lowcoupling Sep 24 '14 at 10:59
  • No, the volley library version you are using? – Ashwani Sep 24 '14 at 11:00
1

Library previous to v2.2 have a issue: https://github.com/forcedotcom/SalesforceMobileSDK-Android/issues/449

You have to update library to v 2.2.0 at least. This is a bug in Volley Library.

Download the latest library from here: https://android.googlesource.com/platform/frameworks/volley/

Or you can do this:

Go to src/com/android/volley/toolbox/BasicNetwork.java and change following lines:

 if (statusCode < 200 || statusCode > 299) {
     throw new IOException();
 }

with

 if (statusCode < 200 || statusCode > 405) {
     throw new IOException();
 }
  • I am using volley 4.4.2 and yet experience this issue – lowcoupling Sep 24 '14 at 12:05
  • Did you tried to change the line? – Ashwani Sep 24 '14 at 12:14
  • I have a jar... Where is that src ? – lowcoupling Sep 24 '14 at 12:15
  • you can get src from framework library link given in post. repace it with jar – Ashwani Sep 24 '14 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.