Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HttpPost request = new HttpPost(SERVICE_URI + "/LoginUser");
- request.setHeader("Accept", "application/json");
- request.setHeader("Content-type", "application/json");
- // Build JSON string
- JSONStringer loginData = new JSONStringer()
- .object()
- .key("userName").value("TEST001")
- .key("SecurityKeyCode").value("PKEY0001")
- .endObject();
- StringEntity entity = new StringEntity(loginData.toString());
- Toast toastB = Toast.makeText(getApplicationContext(),
- loginData.toString() + "\n",
- Toast.LENGTH_SHORT);
- toastB.show();
- request.setEntity(entity);
- // Send request to WCF service
- DefaultHttpClient httpClient = new DefaultHttpClient();
- HttpResponse response = httpClient.execute(request);
- Toast toastA = Toast.makeText(getApplicationContext(),
- response.getStatusLine().getStatusCode() + "\n" + request.toString() + "\n",
- Toast.LENGTH_SHORT);
- toastA.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement