XML <ArrayOfRelatie xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Dekra.Synergy.WS.Models"> <Relatie> <BedrijfAdres /> <BedrijfEmailadres /> <BedrijfNaam>Generali France</BedrijfNaam> <BedrijfPlaats /> <BedrijfPostcode /> <BedrijfTelefoon /> <Classificatie>PRI</Classificatie> <ContactAchternaam>--</ContactAchternaam> <ContactEmailadres /> <ContactInitialen /> <ContactTelefoon /> <ContactTussenvoegsel /> <ContactVoornaam /> <Id>400146</Id> <Referentie /> <Type>C</Type> <VoorkeurCC /> </Relatie> </ArrayOfRelatie>
CLICK EVENT WebClient _webClient = new WebClient(); _webClient.Credentials = new NetworkCredential("....", "...."); _webClient.Headers.Add("Content-type", "application/xml"); _webClient.Headers.Add("Accept", "application/xml"); Uri uriGet = new Uri("https://claimsotap.dekra.com/Bizzoscope WS/api/Relatie?code=400146"); string URL = "https://claimsotap.dekra.com/Bizzoscope WS/api/Relatie"; string Response = _webClient.DownloadString(uriGet); byte[] bytes = Encoding.UTF8.GetBytes(Response); HttpWebRequest request = CreateWebRequest(URL, bytes.Length); using (var requestStream = request.GetRequestStream()) { requestStream.Write(bytes, 0, bytes.Length); } using (var response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode != HttpStatusCode.Created && response.StatusCode != HttpStatusCode.OK) { string message = String.Format("POST failed. Received HTTP {0}", response.StatusCode); throw new ApplicationException(message); } } public HttpResponseMessage Post(Relatie relatie) { logger.Logger.Info("SaveRelatie"); this.relatieRepository.SaveRelatie(relatie); var response = Request.CreateResponse<Relatie>(System.Net.HttpStatusCode.Created, relatie); return response; } public bool SaveRelatie(Relatie relatie) { try { Functions func = new Functions(); Guid generatedGuid = new Guid(); string caseValidationTable = "_CONN_TB_Csnob1799traffic"; logger.Logger.Info("RelatieRepository"); func.CreateRelatie(relatie, generatedGuid, caseValidationTable); logger.Logger.Info("RELATIE " + relatie.Id + " AANGEMAAKT"); return true; } catch (Exception ex) { logger.Logger.ErrorException("Fout tijdens het aanmaken van de relatie.", ex); return false; } } public Guid CreateRelatie(Relatie relationDetails, Guid generatedGuid, string projectNr) { logger.Logger.Info("Functions"); try { if (relationDetails != null) // HERE IT GOES WRONG { logger.Logger.Info("relDet"); ......
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)