package com.dbs.mplus.knuh.httpTask;

import org.ksoap2.serialization.SoapObject;

import java.util.HashMap;
import java.util.concurrent.ExecutionException;


public class HttpRunnable implements Runnable {
  
  private static final String TAG = "HttpRunnable";
  private String soapAction = "";
  private String callMethod = "";
  private HashMap<String, String> mData;
  
  private CallBack callBack;
  
  public HttpRunnable (String soapAction, String callMethod, HashMap<String, String> mData, CallBack callBack) {
    this.soapAction = soapAction;
    this.callMethod = callMethod;
    this.mData      = mData;
    this.callBack   = callBack;
  }
  
  @Override
  public void run() {
    
    try {
      HttpSoapConnection httpSoapConnection = new HttpSoapConnection(soapAction, callMethod, mData);
      
      SoapObject result = httpSoapConnection.execute().get();
      
      callBack.result(result);
    } catch (ExecutionException e) {
    } catch (InterruptedException e) {
    }
    
  }
}
