I'm currently trying to send a JSON string from an android app to a C# webservice I made. The webservice code is simply:
public void PostLocationsAndroid(string data)
{
//DO STUFF
}
However all my requests end up with data
being null. Here's how I'm trying to consume the webservice in the android app:
public void postData(String myValue) {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://myurl.com/myserver/PostLocationsAndroid");
try {
StringEntity se = new StringEntity(myValue);
se.setContentType("application/json; charset=UTF-8");
httppost.setEntity(se);
httppost.setHeader("Accept", "application/json");
HttpParams params = new BasicHttpParams();
params.setParameter("data", valueIWantToSend);
httppost.setParams(params);
HttpResponse response = httpclient.execute(httppost);
}
I've tried several different ways, this is my most recent failure.