ashutiwari4

Untitled

Mar 24th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. public AsyncTask<String, Void, String> discoverServices() {
  2. return new AsyncTask<String, Void, String>() {
  3. @Override
  4. protected void onPreExecute() {
  5. super.onPreExecute();
  6. }
  7.  
  8. @Override
  9. protected String doInBackground(String... params) {
  10. String resultData = "null";
  11. try {
  12. SoapObject request = new SoapObject(Splash.NAMESPACE,
  13. METHOD_NAME_DISCOVER_SERVICES);
  14. System.out.println("Setting Property");
  15. request.addProperty("Name", null);
  16. request.addProperty("UserId", "[email protected]");
  17. request.addProperty("Password","demeler@123");
  18. request.addProperty("Email", null);
  19. request.addProperty("Role", null);
  20.  
  21.  
  22. SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
  23. SoapEnvelope.VER11);
  24. envelope.dotNet = true;
  25. System.setProperty("http.keepAlive", "false");
  26. envelope.setOutputSoapObject(request);
  27. HttpTransportSE androidHttpTransport = new HttpTransportSE(
  28. Splash.SERVICE_URL, 10000);
  29. androidHttpTransport.call(SOAP_ACTION_DISCOVER_SERVICES, envelope);
  30. SoapObject result = (SoapObject) envelope.getResponse();
  31.  
  32. resultData = result.toString();
  33. System.out.println(resultData);
  34. Log.e("Creating session", "ResultData: " + resultData);
  35.  
  36. JSONObject ja = new JSONObject(resultData);
  37.  
  38.  
  39. } catch (SocketTimeoutException e) {
  40. return "Err: Connection Timeout. \n\nPlease make sure your internet connection is working.";
  41. } catch (UnknownHostException e) {
  42. return "Err: Connection Timeout. \n\nPlease make sure your internet connection is working.";
  43. } catch (ConnectException e) {
  44. return "Err: Connection Timeout. \n\nPlease make sure your internet connection is working.";
  45. } catch (Exception e) {
  46. e.printStackTrace();
  47. }
  48. return resultData;
  49. }
  50.  
  51.  
  52. @Override
  53. protected void onPostExecute(String result) {
  54. if (result.contains("Err:"))
  55. dialog(TransactionActivity.this, "Info", "Unable to update Meeting.", true);
  56. else {
  57. dialog(TransactionActivity.this, "Info", "Your meeting " + _meetingNameEditText.getText().toString().trim() + " from " + _timeBookingEditText.getText().toString().replace("-", "to")
  58. + " updated successfully.", true);
  59. super.onPostExecute(result);
  60. }
  61. }
  62. };
Advertisement
Add Comment
Please, Sign In to add comment