is stringbuilder is same in android java and c# ??
im using stringbuilder in c#(REST Webservice).. how can i use with the same functionality in Java?
or im using stringentity in java.wat is the equivalent in c#(REST Webservice)?
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit
HttpResponse response;
JSONObject json = new JSONObject();
String URL ="url";
try{
HttpPost post = new HttpPost(URL);
json.put("CNo",112);
json.put("CName",name);
StringEntity se = new StringEntity(json.toString());
se.setContentType("application/json; charset=utf-8");
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json; charset=utf-8"));
post.setHeader("Accept","application/json");
post.setHeader("Content-type","application/json; charset=utf-8");
String ss= post.toString();
response = client.execute(post);
this is for post()
and in webservice im implementing by
public bool CreateCustomer(StringBuilder strObj)
{
// JavaScriptSerializer js = new JavaScriptSerializer();
// Customer custObj = js.Deserialize<Customer>(strObj.ToString());
// strObj.ToString();
bool Inserted = false;
String connString = ConfigurationManager.ConnectionStrings["connWebOrdering"].ConnectionString;
SqlConnection Conn = new SqlConnection(connString);
try
{
SqlCommand cmd = new SqlCommand("insert into cust(obj) values('" + strObj + "')", Conn);
Conn.Open();
int rowsaffected = cmd.ExecuteNonQuery();
if (rowsaffected == 1)
{
Inserted = true;
}
}
catch (Exception)
{ }
finally
{
Conn.Close();
}
here the inserted data in database is "blank"... the response comes to as "OK..Status 200"