Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VolleyPlus BasicNetwork.performRequest: Unexpected response code 500 for http://takeone.ade.co.ke/index.php #73

Open
xngigez opened this issue Apr 16, 2018 · 3 comments

Comments

@xngigez
Copy link

xngigez commented Apr 16, 2018

I ma getting the above error when I try to submit data via volleyplus to a server. The link works with regular google volley and on localhost.

`public class MainActivity extends AppCompatActivity {
public static final String TAG = "Message";
static String URL_API = "http://takeone.ade.co.ke/index.php";
Button post_button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    post_button = findViewById(R.id.post_button);
    post_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext());
            SimpleMultiPartRequest smr = new SimpleMultiPartRequest(Request.Method.POST, URL_API,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response) {
                            Log.i(MainActivity.TAG, response);
                        }
                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.i(MainActivity.TAG, "VolleyError: " + String.valueOf(error));
                    error.printStackTrace();
                }
            });
            //smr.addMultipartParam("param string", "data:text"," data text");

            smr.setShouldCache(false);
            mRequestQueue.getCache().clear();
            mRequestQueue.add(smr);
        }
    });
}

}`

@1hakr
Copy link
Member

1hakr commented Apr 17, 2018

Pass "text/plain" like this

smr.addMultipartParam("Param string", "text/plain", "data text");

@xngigez
Copy link
Author

xngigez commented Apr 20, 2018

Thank you for your reply, I updated to the latest volleyplus and used the code below.

`public class MainActivity extends AppCompatActivity {
public static final String TAG = "Message";
// static String URL_API = "http://192.168.0.180/platinum/FootballFansChartroom/Tests/upload.php";
// static String URL_API = "http://test.pesabuddy.com/index.php";
static String URL_API = "http://takeone.ade.co.ke/index.php";

ImageView image_image_view;
Button upload_button, pick_image_button;
int REQUEST_GALLERY_JPG = 1;
String image_file_path = "";
Bitmap image_bitmap = null;

TextView log_textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    image_image_view = findViewById(R.id.image_image_view);
    pick_image_button = findViewById(R.id.pick_image_button);
    pick_image_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setType("image/png");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent,"Select PNG"),REQUEST_GALLERY_JPG);
        }
    });

    upload_button = findViewById(R.id.upload_button);
    upload_button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            RequestQueue mRequestQueue = Volley.newRequestQueue(getApplicationContext());
            SimpleMultiPartRequest smr = new SimpleMultiPartRequest(Request.Method.POST, URL_API,
                    new Response.Listener<String>() {
                        @Override
                        public void onResponse(String response) {
                            Log.i(MainActivity.TAG, response);
                            log_textView.setText("Successful");
                        }
                    }, new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Log.i(MainActivity.TAG, "VolleyError: " + String.valueOf(error));
                    log_textView.setText("Error: " + String.valueOf(error));
                    error.printStackTrace();
                }
            });
            smr.addStringParam("text", "test text");
            //  smr.addFile("uploaded_file", image_file_path);

            smr.setShouldCache(false);
            mRequestQueue.getCache().clear();
            mRequestQueue.add(smr);
        }
    });

    log_textView = findViewById(R.id.log_textView);
}

`
But am getting the error below

04-20 12:56:59.668 21152-21561/ke.co.ade.dev.volleyplusmultipartupload D/libc-netbsd: getaddrinfo: takeone.ade.co.ke get result from proxy >> 04-20 12:56:59.668 21152-21561/ke.co.ade.dev.volleyplusmultipartupload I/System.out: propertyValue:true 04-20 12:56:59.669 21152-21561/ke.co.ade.dev.volleyplusmultipartupload I/System.out: [CDS]rx timeout:30000 [socket][0] connection takeone.ade.co.ke/69.16.238.189:80;LocalPort=34176(30000) [CDS]connect[takeone.ade.co.ke/69.16.238.189:80] tm:30 04-20 12:56:59.670 21152-21561/ke.co.ade.dev.volleyplusmultipartupload D/Posix: [Posix_connect Debug]Process ke.co.ade.dev.volleyplusmultipartupload :80 04-20 12:57:00.151 21152-21561/ke.co.ade.dev.volleyplusmultipartupload I/System.out: [socket][/192.168.0.150:34176] connected 04-20 12:57:00.157 21152-21561/ke.co.ade.dev.volleyplusmultipartupload I/System.out: [OkHttp] sendRequest<< 04-20 12:57:01.113 21152-21561/ke.co.ade.dev.volleyplusmultipartupload I/System.out: Close in OkHttp [CDS]close[34176] 04-20 12:57:01.115 21152-21561/ke.co.ade.dev.volleyplusmultipartupload E/Volley: [1013] BasicNetwork.performRequest: Unexpected response code 500 for http://takeone.ade.co.ke/index.php 04-20 12:57:01.123 21152-21152/ke.co.ade.dev.volleyplusmultipartupload I/Message: VolleyError: com.android.volley.error.ServerError 04-20 12:57:01.129 21152-21152/ke.co.ade.dev.volleyplusmultipartupload W/System.err: com.android.volley.error.ServerError 04-20 12:57:01.130 21152-21152/ke.co.ade.dev.volleyplusmultipartupload W/System.err: at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:158)

Is it a server issue, and could know why it is happening?

@1hakr
Copy link
Member

1hakr commented Apr 21, 2018

Yes seems like issue at the server. It means the request data you sent is not getting parsed correctly at the server. Just debug it on the server and fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants