title: java.lang.RuntimeException: Cannot serialize: 08/13/2015
body: <p>I am so sorry if this question is stupid. But i stuck in this error about 2 days. It makes me crazy. This is my problem</p>
  
  <pre><code>11-14 14:28:43.937  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ java.lang.RuntimeException: Cannot serialize: 08/13/2015
  11-14 14:28:43.937  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:708)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:692)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:661)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:645)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:702)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:618)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:198)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.transport.Transport.createRequestData(Transport.java:111)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:119)
  11-14 14:28:43.947  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at com.example.vuong.final_project_pott.view.SearchTicketActivity$JSonAsyncTask.doInBackground(SearchTicketActivity.java:283)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at com.example.vuong.final_project_pott.view.SearchTicketActivity$JSonAsyncTask.doInBackground(SearchTicketActivity.java:242)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
  11-14 14:28:43.957  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
  11-14 14:28:43.967  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
  11-14 14:28:43.967  14479-14605/com.example.vuong.final_project_pott W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
  11-14 14:28:43.967  14479-14605/com.example.vuong.final_project_pott D/Error﹕ Cannot serialize: 08/13/2015 
  </code></pre>
  
  <p>This problem come when I tried calling webmethod of webservices(is built by .NET).  I was looking for in google and starkoverflow, and try same solution as implement KmvSerialize, using MarshalDate class but not working for me.Here is webmethod</p>
  
  <pre><code>[WebMethod]
      public String searchingTickets(String date, String departure, String arrival)
      {
          List&lt;Ticket_Information&gt; listTicket = new List&lt;Ticket_Information&gt;();
          String status;
          DateTime datetime = new DateTime();
          SqlConnection conn = new SqlConnection("workstation id=OrderingTicketsTS.mssql.somee.com;packet size=4096;user id=b5prolh_SQLLogin_1;pwd=dxtcq1cbar;data source=OrderingTicketsTS.mssql.somee.com;persist security info=False;initial catalog=OrderingTicketsTS");
              SqlCommand cmd = new SqlCommand("select * from ticket_information where Date = '" + date + "' and Departure = '" + departure + "' and arrival = '" +arrival+ "'", conn);
              conn.Open();
  
              SqlDataReader dr = cmd.ExecuteReader();
              if (dr.HasRows)
              {
                  while (dr.Read())
                  {
                      Ticket_Information ticket_information = new Ticket_Information();
                      if (dr.GetBoolean(9) == true)
                      {
                          status = "Sold Out";
                      }
                      else
                      {
                          status = "Still";
                      }
                      ticket_information.ID_Ticket = dr.GetString(0);
                      ticket_information.Company = dr.GetString(1);
                      ticket_information.Departure = dr.GetString(2);
                      ticket_information.Arrival = dr.GetString(3);
                      ticket_information.Vehicles_type = dr.GetString(4);
                      ticket_information.Services = dr.GetString(5);
                      datetime = dr.GetDateTime(6);
                      ticket_information.Date = datetime.ToString("MM/dd/yyyy");
                      ticket_information.Time = dr.GetString(7);
                      ticket_information.Price = dr.GetDouble(8);
                      ticket_information.Ticket_Status = status;
                      listTicket.Add(ticket_information);
                  }  
              }    
              return listTicket.ParserJSon();
              conn.Close();
      }
  </code></pre>
  
  <p>Type of date parameter in SQL server is Date. When I run webservices on local and test, It works perfect. After that, I called this method in android by Ksoap2 and my problem appears. 
  Here is my SearchTicketActivity:</p>
  
  <pre><code>public class SearchTicketActivity extends ActionBarActivity implements View.OnClickListener, Serializable {
      private EditText departure;
      private EditText arrival;
      private EditText date;
      private ListView listView;
      private TextView tvtest;
      private ArrayList&lt;JSONObject&gt; arrayList = new ArrayList&lt;JSONObject&gt;();
      private ArrayList&lt;TicketInforModel&gt; ticketInforModelArrayList = new ArrayList&lt;TicketInforModel&gt;();
      private TicketInforModel ticketInforModel;
      private ArrayAdapter&lt;TicketInforModel&gt; arrAdapterTicket;
      private DatePickerDialog fromDatePickerDialog;
      private SimpleDateFormat dateFormatter;
  
  
     private final String TAG_IDTICKET = "ID_Ticket";
      private final String TAG_Company = "Company";
      private final String TAG_Departure = "Departure";
      private final String TAG_Arrival = "Arrival";
      private final String TAG_VEHICLESTYPE = "Vehicles_type";
      private final String TAG_SERVICES = "Services";
      private final String TAG_Date = "Date";
      private final String TAG_Time = "Time";
      private final String TAG_Price = "Price";
      private final String TAG_TicketStatus = "Ticket_Status";
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.searchticket_main);
  
          departure = (EditText)findViewById(R.id.et_departure);
          arrival = (EditText)findViewById(R.id.et_arrival);
          date = (EditText)findViewById(R.id.et_date);
          listView = (ListView)findViewById(R.id.lv_ticket);
          tvtest = (TextView)findViewById(R.id.tv_test);
  
          dateFormatter = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
  
          setDateTimeField();
          Button btn_searching = (Button)findViewById(R.id.btn_searching);
          btn_searching.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  JSonAsyncTask jSonAsyncTask = new JSonAsyncTask();
                  jSonAsyncTask.execute();
                  if(ticketInforModelArrayList.size() &gt;0 ){
                      tvtest.setText("done");
                  }else{
                      tvtest.setText("Error");
                  }
  
  
              }
          });
      }
  
  
      @Override
      public void onClick(View v) {
          if(v == date) {
              fromDatePickerDialog.show();
          }
      }
  
      public class JSonAsyncTask extends AsyncTask&lt;Void, Void,Void&gt; implements Serializable {
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
          }
          @Override
          protected Void doInBackground(Void... params) {
              final String TAG_SOAPACTION1 = "http://tempuri.org/searchingTickets";
              final String TAG_NAMESPACE = "http://tempuri.org/";
              final String TAG_METHODNAME = "searchingTickets";
              final String TAG_URL = "http://vuongphgc60287.somee.com/mywebservices.asmx";
  
  
              SoapObject request=new SoapObject(TAG_NAMESPACE, TAG_METHODNAME);
  
  
              PropertyInfo pi = new PropertyInfo();
              pi.name = "date";
              pi.setValue(date.getText());
              pi.type = String.class;
              request.addProperty(pi);
  
              pi = new PropertyInfo();
              pi.name = "departure";
              pi.setValue(departure.getText());
              pi.type = String.class;
              request.addProperty(pi);
  
              pi.name = "arrival";
              pi.setValue(arrival.getText());
              pi.type = String.class;
              request.addProperty(pi);
  
              SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
              envelope.dotNet=true;
  
              envelope.setOutputSoapObject(request);
              HttpTransportSE transport=new HttpTransportSE(TAG_URL);
              transport.debug = true;
  
              try{
                  transport.call(TAG_SOAPACTION1,envelope);
                  SoapPrimitive data = (SoapPrimitive) envelope.getResponse();
  
                  String jsonText=data.toString();
                  JSONArray jsonArray=new JSONArray(jsonText);
  
                  for(int i = 0; i&lt;jsonArray.length();i++){
                      ticketInforModel = new TicketInforModel();
                      JSONObject jsonObject =(JSONObject)jsonArray.getJSONObject(i);
                      ticketInforModel.set_IdTicket(jsonObject.getString(TAG_IDTICKET).toString());
                      ticketInforModel.set_company(jsonObject.getString(TAG_Company).toString());
                      ticketInforModel.set_departure(jsonObject.getString(TAG_Departure).toString());
                      ticketInforModel.set_arrival(jsonObject.getString(TAG_Arrival).toString());
                      ticketInforModel.set_vehicletype(jsonObject.getString(TAG_VEHICLESTYPE).toString());
                      ticketInforModel.set_services(jsonObject.getString(TAG_SERVICES).toString());
                      ticketInforModel.set_date(jsonObject.getString(TAG_Date).toString());
                      ticketInforModel.set_time(jsonObject.getString(TAG_Time).toString());
                      ticketInforModel.set_price(Double.parseDouble(jsonObject.getString(TAG_Price).toString()));
                      ticketInforModel.set_ticket_Status(jsonObject.getString(TAG_TicketStatus).toString());
                      ticketInforModelArrayList.add(ticketInforModel);
                  }
  
              }catch (JSONException e){
                  Log.d("JSON",e.getMessage());
                  e.printStackTrace();
              } catch (XmlPullParserException e) {
                  e.printStackTrace();
                  Log.d("Loi gi day",e.getMessage());
              } catch (SoapFault soapFault) {
                  soapFault.printStackTrace();
                  Log.d("Soap",soapFault.getMessage());
              } catch (IOException e) {
                  e.printStackTrace();
              }catch (Exception ex){
                  ex.printStackTrace();
                  Log.d("Error", ex.getMessage());
              }
              return null;
          }
          @Override
          protected void onPostExecute(Void result) {
  
          }
      }
  
      private void setDateTimeField() {
          try{
              date.setOnClickListener(this);
              final Calendar newCalendar = Calendar.getInstance();
              fromDatePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
                  public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                      Calendar newDate = Calendar.getInstance();;
                      newDate.set(year, monthOfYear, dayOfMonth-1);
                      if(newDate.getTime().getTime() &gt; (newCalendar.getTime().getTime())){
                          final AlertDialog builder = new AlertDialog.Builder(SearchTicketActivity.this).setTitle("Notification").setMessage("This is a date of future! We will get current date for this review!").show();
  
                          //this code below is coppied in https://xjaphx.wordpress.com/2011/07/13/auto-close-dialog-after-a-specific-time/
                          final Timer t = new Timer();
                          t.schedule(new TimerTask() {
                              public void run() {
                                  builder.dismiss(); // when the task active then close the dialog
                                  t.cancel(); // also just top the timer thread, otherwise, you may receive a crash report
                              }
                          }, 2000); // after 2 second (or 2000 miliseconds), the task will be active.
                          date.setText(dateFormatter.format(newCalendar.getTime()));
  
                      }
  
                      else{
                          newDate.set(year, monthOfYear, dayOfMonth);
                          date.setText(dateFormatter.format(newDate.getTime()));
                      }
                  }
              },newCalendar.get(Calendar.YEAR), newCalendar.get(Calendar.MONTH), newCalendar.get(Calendar.DAY_OF_MONTH));
          }catch(Exception ex){
              showMessages("Something Wrong!");
          }
      }
  
      private void showMessages(String messages) {
          new AlertDialog.Builder(this).setTitle("Notification").setMessage(messages).setNeutralButton("OK", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
  
              }
          }).show();
      }
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
  
  }
  </code></pre>
  
  <p>Here is TicketInforModel: </p>
  
  <pre><code>public class TicketInforModel implements Serializable {
  
      //Data Ticket
      private String _IdTicket;
      private String _company;
      private String _departure;
      private String _arrival;
      private String _vehicletype;
      private String _services;
      private String _date;
      private String _time ;
      private double _price;
      private String _ticket_Status ;
  
      public TicketInforModel(String IDticket,String Company, String Departure, String Arrival, String Vehicletype, String Services, String Date, String Time, double Price, String Ticket_status){
          this.set_IdTicket(IDticket);
          this.set_company(Company);
          this.set_departure(Departure);
          this.set_arrival(Arrival);
          this.set_vehicletype(Vehicletype);
          this.set_services(Services);
          this.set_date(Date);
          this.set_time(Time);
          this.set_price(Price);
          this.set_ticket_Status(Ticket_status);
      }
      public TicketInforModel(){
  
      }
  
  
      public String get_company() {
          return _company;
      }
  
      public void set_company(String _company) {
          this._company = _company;
      }
  
      public String get_departure() {
          return _departure;
      }
  
      public void set_departure(String _departure) {
          this._departure = _departure;
      }
  
      public String get_arrival() {
          return _arrival;
      }
  
      public void set_arrival(String _arrival) {
          this._arrival = _arrival;
      }
  
      public String get_vehicletype() {
          return _vehicletype;
      }
  
      public void set_vehicletype(String _vehicletype) {
          this._vehicletype = _vehicletype;
      }
  
      public String get_services() {
          return _services;
      }
  
      public void set_services(String _services) {
          this._services = _services;
      }
  
      public String get_date() {
          return _date;
      }
  
      public void set_date(String _date) {
          this._date = _date;
      }
  
      public String get_time() {
          return _time;
      }
  
      public void set_time(String _time) {
          this._time = _time;
      }
  
      public double get_price() {
          return _price;
      }
  
      public void set_price(double _price) {
          this._price = _price;
      }
  
      public String get_ticket_Status() {
          return _ticket_Status;
      }
  
      public void set_ticket_Status(String _ticket_Status) {
          this._ticket_Status = _ticket_Status;
      }
  
      public String get_IdTicket() {
          return _IdTicket;
      }
  
      public void set_IdTicket(String _IdTicket) {
          this._IdTicket = _IdTicket;
      }
  
  }
  </code></pre>
  
  <p>You can view my webservices in <a href="http://vuongphgc60287.somee.com/mywebservices.asmx" rel="nofollow">here</a></p>
  
  <p>Please help me if you can and thanks for reading my question.</p>