2017-02-21 63 views
0

我正在更新的对象上,当我创建的XML被successefuly存储:updateBuilder并通过一个XML

     DatabaseHelper db = new DatabaseHelper(getActivity()); 

         Dao<Demandes, Integer> demandesDao = null; 

         try { 
          demandesDao = db.getDemandesDao(); 
          Demandes maDemande = new Demandes(xml, 0, null, 0, "", 0, null); 
          demandesDao.create(maDemande); 
          demandeId = maDemande.getId(); 
          xml = xml.replace("<IdContactClient></IdContactClient>", "<IdContactClient>" + demandeId + "</IdContactClient>"); 
          System.out.println(xml); 
          AsyncSoapCall task = new AsyncSoapCall(maDemande); 
          task.execute(); 
         } catch (SQLException e) { 
          e.printStackTrace(); 
         } 

但是,当我试图更新,这是行不通的,当我传递一个随机文本,它看起来工作,这是因为XML?

     DatabaseHelper db = new DatabaseHelper(getActivity()); 

         Dao<Demandes, Integer> demandesDao = null; 
         try { 
          demandesDao = db.getDemandesDao(); 
          UpdateBuilder<Demandes,Integer> updateBuilder = demandesDao.updateBuilder(); 
          updateBuilder.where().eq("id", demande.getId()); 


          updateBuilder.updateColumnValue("statutEnvoieSendLead", 1); 
          updateBuilder.updateColumnValue("dateEnvoieSendLead", new Date()); 
          updateBuilder.updateColumnValue("contactWebId", slr.getOption().getContactWebID()); 


          GoogleAnalytics ga = new GoogleAnalytics(getActivity()); 
          ga.envoieTracker(idApplication, demandeId, logement, typeForm); 


          XMLSendSimulation xmlSendSimulation = new XMLSendSimulation(slr.getOption().getContactWebID()); 
          xml = XMLGenerator.GenerateSendSimulationXml(xmlSendSimulation); 
          //xml = "test test test fkzejfiehzifhh ghreuhgiuhguiheuiguiehgiuhughheghiuehiue hhuih guh gheugregergergergregregergregg hgu hghhguherhrehgheghegerhgueuihguhge rge g e ger 123"; 
          updateBuilder.updateColumnValue("xmlSimulation", xml); 
          updateBuilder.update(); 

          SendSimulationReponse sr = soapContact.Simulation(xml); 

          openSimulation = sr.getOption().getOpenSimulation(); 


          if (sr.getCode() == 1){ 

           Date dateSimulation = new Date(); 

           updateBuilder.updateColumnValue("dateEnvoieSimulation", new Date()); 
           updateBuilder.updateColumnValue("statutEnvoieSimulation", 1); 

           if (openSimulation == true){ 
            resultatDemande = 1; 
           } else if (openSimulation == false) { 
            resultatDemande = 2; 
           } 

          } 


         } catch (SQLException e) { 
          e.printStackTrace(); 
         } 

XML:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><CourtactSioux><ListeContact><IdContactClient>120000379</IdContactClient></ListeContact></CourtactSioux> 
+0

它不起作用?你得到了什么错误? – Gray

+0

@格雷我刚测试没有单引号它的工作,但我没有得到任何错误...所以我只是做了一个准备的请求 – Ben

回答

0

如果这样做的一个准备请求将成功这一点,我没有得到我的控制台上的任何错误,但是从单打报价问题就来了。