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.4
edited by Robert Jan Daams
on 2022/08/23 11:15
on 2022/08/23 11:15
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
-
... ... @@ -23,29 +23,11 @@ 23 23 As part of on-going efforts to improve performance and scalability, we have introduced a dedicated version of DataWS named DataWSExternals. This new service should be used for external API consumers. 24 24 25 25 | |**URL**| 26 -|**Old**|{{code language="none"}}https://web.terraindex.com/DataWS/{{/code}}| (((27 -[[https:~~/~~/web.terraindex.com/DataWS/ITW DataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON]]26 +|**Old**|{{code language="none"}}https://web.terraindex.com/DataWS/{{/code}}|[[https:~~/~~/web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx?wsdl>>https://web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 27 +|**New**|{{code language="none"}}https://web.terraindex.com/DataWSExternals/{{/code}}|[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 28 28 29 -[[https:~~/~~/web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx]] 30 -))) 31 -|**New**|{{code language="none"}}https://web.terraindex.com/DataWSExternals/{{/code}}|((( 32 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]] 33 - 34 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 35 -))) 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]]253 +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: 255 +To start connecting this webservice, you should use this URL of the Import Export Webservice: 256 +[[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 - 392 + 393 +== Zip Stream class == 394 + 395 +If needed, this is the Zip Stream class you can use to extract the zipstream as used above: 396 + 397 +{{code language="Csharp" layout="LINENUMBERS"}} 398 +/// <summary> 399 +/// Helper class for compress en decompress of file data 400 +/// </summary> 401 +public static class ZipStreamHelper { 402 + #region Compress and encode 403 + /// <summary> 404 + /// Comprimeer een string en geeft deze terug in Base64 string. 405 + /// </summary> 406 + /// <param name="content">filecontent</param> 407 + /// <returns>gecomprimeerde string</returns> 408 + public static string CompressToBase64String(string content) { 409 + //string to byte[] 410 + byte[] contentArray = stringToByteArray(content); 411 + // Compress 412 + byte[] compressed = Compress(contentArray); 413 + return base64_encode(compressed); 414 + } 415 + 416 + /// <summary> 417 + /// Zet een string om naar een ByteArray 418 + /// </summary> 419 + /// <param name="content">filecontent</param> 420 + /// <returns>ByteArray</returns> 421 + public static byte[] stringToByteArray(string content) { 422 + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); 423 + return encoding.GetBytes(content); 424 + } 425 + 426 + /// <summary> 427 + /// comprimeer een ByteArray 428 + /// </summary> 429 + /// <param name="data">filedata als ByteArray</param> 430 + /// <returns>gecomprimeerde ByteArray</returns> 431 + public static byte[] Compress(byte[] data) { 432 + using(var compressedStream = new MemoryStream()) 433 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { 434 + zipStream.Write(data, 0, data.Length); 435 + zipStream.Close(); 436 + return compressedStream.ToArray(); 437 + } 438 + } 439 + 440 + /// <summary> 441 + /// Zet een ByteArray om naar een Base64 string 442 + /// </summary> 443 + /// <param name="data">gecomprimeerde ByteArray</param> 444 + /// <returns>Base 64 string</returns> 445 + public static string base64_encode(byte[] data) { 446 + if (data == null) 447 + return string.Empty; 448 + return Convert.ToBase64String(data); 449 + } 450 + 451 + /// <summary> 452 + /// Zet een string om naar een Base64 string 453 + /// </summary> 454 + /// <param name="data">string</param> 455 + /// <returns>Base 64 string</returns> 456 + public static string string_base64_encode(string data) { 457 + if (string.IsNullOrEmpty(data)) 458 + return string.Empty; 459 + 460 + //string to byte[] 461 + byte[] contentArray = stringToByteArray(data); 462 + return base64_encode(contentArray); 463 + } 464 + #endregion 465 + 466 + #region Decompress and decode 467 + // Decode and decompress 468 + /// <summary> 469 + /// Decomprimeer een Base64 string naar een string 470 + /// </summary> 471 + /// <param name="contentBase64">GZIP Base64 string</param> 472 + /// <returns>string</returns> 473 + public static string DecompressBase64StringToString(string contentBase64) { 474 + // Decompress 475 + byte[] decoded = base64_decode(contentBase64); 476 + byte[] decompressed = Decompress(decoded); 477 + 478 + return byteArrayTostring(decompressed); 479 + } 480 + 481 + /// <summary> 482 + /// Zet een ByteArray om in een normale string 483 + /// </summary> 484 + /// <param name="data">ByteArray</param> 485 + /// <returns>string</returns> 486 + public static string byteArrayTostring(byte[] data) { 487 + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 488 + return enc.GetString(data); 489 + } 490 + 491 + /// <summary> 492 + /// Zet een Base64 string om naar een ByteArray 493 + /// </summary> 494 + /// <param name="encodedData">Base64 string</param> 495 + /// <returns>gecomprimeerde ByteArray</returns> 496 + public static byte[] base64_decode(string encodedData) { 497 + byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); 498 + return encodedDataAsBytes; 499 + } 500 + 501 + /// <summary> 502 + /// Zet een gecomprimeerde ByteArray om in een ByteArray 503 + /// </summary> 504 + /// <param name="data">gecomprimeerde ByteArray</param> 505 + /// <returns>ByteArray (gedecomprimeerd)</returns> 506 + public static byte[] Decompress(byte[] data) { 507 + using(var compressedStream = new MemoryStream(data)) 508 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 509 + using(var resultStream = new MemoryStream()) { 510 + var buffer = new byte[4096]; 511 + int read; 512 + 513 + while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) { 514 + resultStream.Write(buffer, 0, read); 515 + } 516 + 517 + return resultStream.ToArray(); 518 + } 519 + } 520 + #endregion 521 +} 522 +{{/code}} 412 412 ))) 413 413 414 414