Changes for page Download a project (export)
Last modified by Nico Lemaire on 2025/09/01 13:36
From version 15.4
edited by Robert Jan Daams
on 2025/03/05 18:01
on 2025/03/05 18:01
Change comment:
There is no comment for this version
To version 6.7
edited by Robert Jan Daams
on 2022/08/24 15:16
on 2022/08/24 15:16
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Downloadaproject(export)1 +Setting up a Webservice connection for project exports - Parent
-
... ... @@ -1,1 +1,1 @@ 1 -Implementation documentation. For customers.WebHome1 +Implementation documentation.WebHome - Content
-
... ... @@ -31,21 +31,11 @@ 31 31 |**New**|{{code language="none"}}https://web.terraindex.com/DataWSExternals/{{/code}}|((( 32 32 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]] 33 33 34 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService ASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]]34 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]] 35 35 ))) 36 36 37 37 == == 38 38 39 -{{info}} 40 -We also have new REST Calls, with the same Input Output formats: 41 -\\[[https:~~/~~/web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export>>https://web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export]] 42 - 43 -input as json: ExportRequest 44 -output as json: ExportResult 45 - 46 -as POST or GET 47 -{{/info}} 48 - 49 49 == 1. Retreive all changed project from TerraIndex == 50 50 51 51 To retreive all changed project from the TerraIndex database since a specific timestamp, there is a webservice call you can do. This will return all project rows that have changes since the timestamp you send within the request. ... ... @@ -268,12 +268,11 @@ 268 268 == 2. Retreive the project export from TerraIndex == 269 269 270 270 To request the export from TerraIndex we have a SOAP webservice. This webservice is called the ExportService, and it will provide a full project in TerraIndex Format. 271 -The format of the projectfile is documentated here: [[Documentation TerraIndex Export format - dsFieldProject.xsd>>Implementation documentation. For customers.Documentation TerraIndex Export format - dsFieldProject\.xsd.WebHome]]261 +The format of the projectfile is documentated here: [[Documentation TerraIndex Export format - dsFieldProject.xsd>>Implementation documentation.Documentation TerraIndex Export format - dsFieldProject\.xsd.WebHome]] 272 272 273 -To start connecting this webservice, you should use this URL of the Import Export Webservice: 263 +To start connecting this webservice, you should use this URL of the Import Export Webservice: 264 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx]] 274 274 275 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]] 276 - 277 277 With this URL many IDE’s can create a proxy for you, just by providing the URL. Once this proxy is created, you will have a few classes looking like the call in the image below. 278 278 279 279 [[image:image-20200108-123431.png]] ... ... @@ -408,7 +408,137 @@ 408 408 </soap:Envelope> 409 409 {{/code}} 410 410 411 - 400 + 401 +== Zip Stream class == 402 + 403 +If needed, this is the Zip Stream class you can use to extract the zipstream as used above: 404 + 405 +{{code language="Csharp" layout="LINENUMBERS"}} 406 +/// <summary> 407 +/// Helper class for compress en decompress of file data 408 +/// </summary> 409 +public static class ZipStreamHelper { 410 + #region Compress and encode 411 + /// <summary> 412 + /// Comprimeer een string en geeft deze terug in Base64 string. 413 + /// </summary> 414 + /// <param name="content">filecontent</param> 415 + /// <returns>gecomprimeerde string</returns> 416 + public static string CompressToBase64String(string content) { 417 + //string to byte[] 418 + byte[] contentArray = stringToByteArray(content); 419 + // Compress 420 + byte[] compressed = Compress(contentArray); 421 + return base64_encode(compressed); 422 + } 423 + 424 + /// <summary> 425 + /// Zet een string om naar een ByteArray 426 + /// </summary> 427 + /// <param name="content">filecontent</param> 428 + /// <returns>ByteArray</returns> 429 + public static byte[] stringToByteArray(string content) { 430 + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); 431 + return encoding.GetBytes(content); 432 + } 433 + 434 + /// <summary> 435 + /// comprimeer een ByteArray 436 + /// </summary> 437 + /// <param name="data">filedata als ByteArray</param> 438 + /// <returns>gecomprimeerde ByteArray</returns> 439 + public static byte[] Compress(byte[] data) { 440 + using(var compressedStream = new MemoryStream()) 441 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { 442 + zipStream.Write(data, 0, data.Length); 443 + zipStream.Close(); 444 + return compressedStream.ToArray(); 445 + } 446 + } 447 + 448 + /// <summary> 449 + /// Zet een ByteArray om naar een Base64 string 450 + /// </summary> 451 + /// <param name="data">gecomprimeerde ByteArray</param> 452 + /// <returns>Base 64 string</returns> 453 + public static string base64_encode(byte[] data) { 454 + if (data == null) 455 + return string.Empty; 456 + return Convert.ToBase64String(data); 457 + } 458 + 459 + /// <summary> 460 + /// Zet een string om naar een Base64 string 461 + /// </summary> 462 + /// <param name="data">string</param> 463 + /// <returns>Base 64 string</returns> 464 + public static string string_base64_encode(string data) { 465 + if (string.IsNullOrEmpty(data)) 466 + return string.Empty; 467 + 468 + //string to byte[] 469 + byte[] contentArray = stringToByteArray(data); 470 + return base64_encode(contentArray); 471 + } 472 + #endregion 473 + 474 + #region Decompress and decode 475 + // Decode and decompress 476 + /// <summary> 477 + /// Decomprimeer een Base64 string naar een string 478 + /// </summary> 479 + /// <param name="contentBase64">GZIP Base64 string</param> 480 + /// <returns>string</returns> 481 + public static string DecompressBase64StringToString(string contentBase64) { 482 + // Decompress 483 + byte[] decoded = base64_decode(contentBase64); 484 + byte[] decompressed = Decompress(decoded); 485 + 486 + return byteArrayTostring(decompressed); 487 + } 488 + 489 + /// <summary> 490 + /// Zet een ByteArray om in een normale string 491 + /// </summary> 492 + /// <param name="data">ByteArray</param> 493 + /// <returns>string</returns> 494 + public static string byteArrayTostring(byte[] data) { 495 + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 496 + return enc.GetString(data); 497 + } 498 + 499 + /// <summary> 500 + /// Zet een Base64 string om naar een ByteArray 501 + /// </summary> 502 + /// <param name="encodedData">Base64 string</param> 503 + /// <returns>gecomprimeerde ByteArray</returns> 504 + public static byte[] base64_decode(string encodedData) { 505 + byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); 506 + return encodedDataAsBytes; 507 + } 508 + 509 + /// <summary> 510 + /// Zet een gecomprimeerde ByteArray om in een ByteArray 511 + /// </summary> 512 + /// <param name="data">gecomprimeerde ByteArray</param> 513 + /// <returns>ByteArray (gedecomprimeerd)</returns> 514 + public static byte[] Decompress(byte[] data) { 515 + using(var compressedStream = new MemoryStream(data)) 516 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 517 + using(var resultStream = new MemoryStream()) { 518 + var buffer = new byte[4096]; 519 + int read; 520 + 521 + while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) { 522 + resultStream.Write(buffer, 0, read); 523 + } 524 + 525 + return resultStream.ToArray(); 526 + } 527 + } 528 + #endregion 529 +} 530 +{{/code}} 412 412 ))) 413 413 414 414