Esempio n. 1
0
    @Override
    protected DSResponse doInBackground(DSRequest... reqs) {
      ContractConnection conn = mCn;

      DSRequest req = reqs[0];
      Log.d("DEBUG", "Start Async Task ........ !");
      DSResponse rsp = null;
      try {
        Log.d("DEBUG", "Start get response ........ !");
        rsp = conn.sendRequest(ServiceConstant.Service_Student_FindStudents, req);
      } catch (Exception ex) {
        Log.d("DEBUG", "Get Exception ......... !");
        ex.printStackTrace();
        if (mListener != null) mListener.onFail(ex);
      }
      return rsp;
    }
Esempio n. 2
0
  public static ContractConnection connectTo(String dsns, String contract, String accessToken) {

    // Allow Access Internet in Main Thread !
    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    Element token =
        XmlHelper.parseXml(
            "<SecurityToken Type='PassportAccessToken'><AccessToken>"
                + accessToken
                + "</AccessToken></SecurityToken>");

    // dsns name
    ContractConnection cc = new ContractConnection(new DSNSTargetURLProvider(dsns), contract);
    cc.connect(new GeneralToken(token), true);

    return cc;
  }