Passing Parameter & Headers with Apache HttpDelete for Rest Web Service Android -


i have end point of http delete method. want pass headers, more content-type=application/x-www-form-urlencoded. there parameters based on @ server side decided record should deleted. and server implementation not accessible me.

i using apache http client. method http delete follow :

private string dodelete(string url, map<string,string> params, map<string,string> headermap){      httpclient httpclient = new defaulthttpclient(httpparams);     httpdelete httpdelete = new httpdelete(httprequestwrapper.geturl());      if(headermap != null){         for(string headername : headermap.keyset()){             httpdelete.addheader(headername, headermap.get(headername));         }     }      if(params != null){                  for(string paramname : params.keyset()){             httpparams.setparameter(paramname, params.get(paramname));         }         httpdelete.setparams(httpparams);     }      httpresponse httpresponse = httpclient.execute(httpdelete);     httpentity httpentity = httpresponse.getentity();     string responsestr = getasciicontentfromentity(httpentity);     return responsestr;  } 

the problem is, seeing (in debug mode) parameters correctly being passed in delete request end. @ server end parameters received blank. there way can pass parameters & headers successfully?

any appreciated.

passing headers through verbatim may cause problems.

with above in mind, advised that, implemented, httpdelete method not take body having particular content-type header associated request may causing interference confusing container.

try omitting header client containing content-type , see if resolves issue.

edit ah!! found issue! setparams method confusing. according documentation http client 4.x

provides parameters used processing of message.

the parameters you're setting in code not passed because being conveyed underlying client executing request.

this article defines appropriate approach you're attempting.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -