java - Unpredictable results when sending HTTP POST using DefaultHttpClient -


i'm using defaulthttpclient send http post request containing json raw data:

defaulthttpclient httpclient = new defaulthttpclient(); httppost httppostreq = new httppost(post_url);  stringentity se = new stringentity(json.tostring()); // json jsonobject  se.setcontenttype("application/json;charset=utf-8");  se.setcontentencoding(new basicheader(http.content_type,"application/json;charset=utf-8"));  httppostreq.setentity(se);  httpresponse httpresponse = httpclient.execute(httppostreq);  string responsetext = entityutils.tostring(httpresponse.getentity()); 

i'm using send 5 requests, , result must json-raw-response, although i'm getting first 2 responses predicted other 3 i'm getting html code of webpage:

<!doctype html>    <html>      <head>        <meta charset="utf-8"><title>web service</title>         <link rel="stylesheet" href="/css/merge.css"/>         <script type="text/javascript"> ..... till end of webpage 

so, can lead me result , can wrong in work?


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -