c# - Post Json Data using volly library to wcf rest service -
i migrating asynctask volley.in application want json data wcf rest service.my code below
stringrequest postrequest = new stringrequest(request.method.post, url, new response.listener<string>() { @override public void onresponse(string response) { // response log.d("response", response); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { // todo auto-generated method stub if(error.networkresponse != null && error.networkresponse.data != null){ volleyerror error2 = new volleyerror(new string(error.networkresponse.data)); error = error; } log.d("error", "error => " + error.tostring()); } } ) { @override protected map<string, string> getparams() { map<string, string> params1 = new hashmap<>(); params1.put("userid", "123"); params1.put("password", "123"); return params1; } @override public map<string, string> getheaders() { hashmap<string, string> headers = new hashmap<string, string>(); headers.put("content-type", "application/json; charset=utf-8"); return headers; } } ;
but getting error 'http error 400. request has invalid header name' wcf service...
sorry late reply.there problem wcf rest service give backslash encoded json volley didnt got json content type
Comments
Post a Comment