android - Http Request Status 400 -


i trying send request web service on android , returns status 400 know status 400 means bad request, cant see wrong. how can fix this?

here request code:

httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://10.0.2.2:1455/android/android.svc/getcompanybusinessareas2");  try {     list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>();     namevaluepairs.add(new basicnamevaluepair("company", companhiaids));      httppost.setentity(new urlencodedformentity(namevaluepairs));     //httppost.g     //httppost.setentity(new stringentity(companhiaids));     log.i("enviando:", namevaluepairs.tostring());      // execute http post request     httpresponse response = httpclient.execute(httppost);     log.i("resposta:", response.getentity().tostring());     log.i("status","" +  response.getstatusline().getstatuscode());     httpentity responseentity = response.getentity();      char[] buffer = new char[(int) responseentity.getcontentlength()];     log.i("buffer:","" + responseentity.getcontentlength());      try {         inputstream stream = responseentity.getcontent();         inputstreamreader reader = new inputstreamreader(stream);         reader.read(buffer);         stream.close();         reader.close();     } catch (ioexception e) {         e.printstacktrace();         log.i("exception", e.getmessage());     }      //fim da ligacao wcf     string reply2 = new string(buffer);     log.i("teste", reply2);   } catch (unsupportedencodingexception e) {     // todo auto-generated catch block     e.printstacktrace(); } catch (clientprotocolexception e) {     // todo auto-generated catch block     e.printstacktrace(); } catch (ioexception e) {     // todo auto-generated catch block     e.printstacktrace(); } 

the variable companhiaids string.

yes mean bad request. means backend unable process request


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -