Android : How to call the JSON webservice?

on Wednesday, September 24, 2014


I am trying to call this web service but it's response is null



<script type="text/javascript">
jQuery(document).ready(function(){
var user = {nick :"rajesh", password:"123456", device_id:"123456677"};
jQuery.ajax({
type: "post",
data :JSON.stringify(user),
url: "http://localhost:81/sazpin/user/users/index.json",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
console.log(data);
}
});
});
</script>


My httppost client is



HttpClient httpClient = new DefaultHttpClient();

// post header
HttpPost httpPost = new HttpPost(url);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");


Please somebody help me How to call this webservice and get the response?


0 comments:

Post a Comment