예제 #1
0
  protected String getValidationBodyXml(String phoneNumber, String validationCode) {

    XmlSerializer serializer = Xml.newSerializer();
    StringWriter writer = new StringWriter();
    try {
      serializer.setOutput(writer);
      serializer.startDocument("UTF-8", true);
      String ns = RegistrationUtil.NS;
      serializer.startTag(ns, "validation");

      RegistrationUtil.serializeProperty(serializer, ns, "phoneNumber", phoneNumber);
      RegistrationUtil.serializeProperty(serializer, ns, "validationCode", validationCode);

      serializer.endTag(ns, "validation");
      serializer.endDocument();
      return writer.toString();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
예제 #2
0
  protected String getEnrolmentBodyXml(SIP5060ProvisioningRequest req) {

    SharedPreferences settings =
        getSharedPreferences(RegisterAccount.PREFS_FILE, Context.MODE_PRIVATE);

    String enrolmentNum = settings.getString(RegisterAccount.PREF_PHONE_NUMBER, "");

    XmlSerializer serializer = Xml.newSerializer();
    StringWriter writer = new StringWriter();
    try {
      serializer.setOutput(writer);
      serializer.startDocument("UTF-8", true);
      String ns = RegistrationUtil.NS;
      serializer.startTag(ns, "enrolment");

      RegistrationUtil.serializeProperty(serializer, ns, "phoneNumber", enrolmentNum);
      RegistrationUtil.serializeProperty(serializer, ns, "secret", req.getAuthPassword());
      RegistrationUtil.serializeProperty(serializer, ns, "firstName", "");
      RegistrationUtil.serializeProperty(serializer, ns, "lastName", "");
      RegistrationUtil.serializeProperty(serializer, ns, "emailAddress", "");
      RegistrationUtil.serializeProperty(serializer, ns, "language", getLanguage());

      serializer.endTag(ns, "enrolment");
      serializer.endDocument();
      return writer.toString();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }