hi friends,
i am inserting data from my mobile to SQL Server using WCF web services.but
Data is not inserting.So please help me any one.i wrote below code for
that,check it is correct or not.it is giveing response code is 400.
thank you,
// POST request to <service>
HttpPost request = new HttpPost(URL);
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
/*@EmployeeID,@LeaveTypeID,@SessionID,@FromDate,@ToDate,@TotalDays,@Balance,
* @IsApproved,@IsRejected,@IsExported*/
// Build JSON string
JSONStringer insert = new JSONStringer()
.object()
.key("insert")
.object()
.key("empid").value(emp_id)
.key("leavecode").value(code)
.key("sessionid").value(sesson_id)
.key("fromdate").value(fDate)
.key("todate").value(tDate)
.key("totaldays").value(tdays)
.key("balance").value(balance)
.key("isapproved").value(isApproved)
.key("isrejected").value(isRejected)
.key("isexported").value(isExported)
.endObject()
.endObject();
StringEntity entity = new StringEntity(insert.toString());
request.setEntity(entity);
// Send request to WCF service
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(request);
Log.d("WebInvoke", "Saving : " +
response.getStatusLine().getStatusCode());
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.