Changes for page Download a project (export)
Last modified by Nico Lemaire on 2025/09/01 13:36
From version 15.6
edited by Nico Lemaire
on 2025/09/01 13:36
on 2025/09/01 13:36
Change comment:
There is no comment for this version
To version 6.6
edited by Robert Jan Daams
on 2022/08/23 11:18
on 2022/08/23 11:18
Change comment:
There is no comment for this version
Summary
-
Page properties (4 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 - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. NicoLemaire1 +XWiki.RjDaams - Content
-
... ... @@ -25,27 +25,13 @@ 25 25 | |**URL**| 26 26 |**Old**|{{code language="none"}}https://web.terraindex.com/DataWS/{{/code}}|((( 27 27 [[https:~~/~~/web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON]] 28 - 29 -[[https:~~/~~/web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx]] 30 30 ))) 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 - 34 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 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]]257 +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: 259 +To start connecting this webservice, you should use this URL of the Import Export Webservice: 260 +[[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]] ... ... @@ -287,8 +287,7 @@ 287 287 Also fill the license and the applicationCode. //(These two fields can be requested at the TerraIndex Servicedesk.)// 288 288 5; Fill the **ExportType **'**Export_FIELD_XML_v1_0_0**’. This export corresponds with dsFieldProject.xsd and is the best XML to connect TI with. 289 289 Create at least create 2 parameters as in the image. Beacause 2 parameters are needed. 290 -//If JSON is prevered use: ExportType = 'Export_FIELD_JSON_v1_0_0' 291 -For other export types, see the end of this page// 275 +//If JSON is prevered use: ExportType = 'Export_FIELD_JSON_v1_0_0'// 292 292 6; Fill the parameter with the FileName. 293 293 7; Fill the parameter with **projectID**. Instead of ‘ProjectID' it’s also possible to fill the parameter ‘ProjectCode'. 294 294 8; Send the request and wait for the reponse. In response field ‘ResultCode’ should be 'SUCCES’ when it all went OK. If not it will tell what went wrong. ... ... @@ -410,31 +410,139 @@ 410 410 {{/code}} 411 411 412 412 413 - **Listof exporttypes:**397 +== Zip Stream class == 414 414 415 -* Export_TI_v1_0_0 416 -* Export_FIELD_XML_v1_0_0 417 -* Export_FIELD_JSON_v1_0_0 418 -* Export_Field_Codelist_XML 419 -* Export_Field_Codelist_JSON 420 -* Export_OVAM_MISTRAL2_v8_4_0 421 -* Export_DOV 422 -* Export_IMSIKB_v14_3_0 423 -* Export_IMSIKB_v13_5_0 424 -* Export_BRO_GMW 425 -* Export_BRO_BHR_GT 426 -* Export_BRO_GAR 427 -* Export_IMSIKB_v14_7_0 428 -* Export_IMSIKB_v14_8_0 429 -* Export_BRO_SAD_IMBROA_Registration 430 -* Export_BRO_SAD_IMBROA_Correction 431 -* Export_BRO_SAD_IMBRO_Registration 432 -* Export_BRO_SAD_IMBRO_Correction 433 -* Export_IMSIKB_v14_9_0 434 -))) 399 +If needed, this is the Zip Stream class you can use to extract the zipstream as used above: 435 435 401 +{{code language="Csharp" layout="LINENUMBERS"}} 402 +/// <summary> 403 +/// Helper class for compress en decompress of file data 404 +/// </summary> 405 +public static class ZipStreamHelper { 406 + #region Compress and encode 407 + /// <summary> 408 + /// Comprimeer een string en geeft deze terug in Base64 string. 409 + /// </summary> 410 + /// <param name="content">filecontent</param> 411 + /// <returns>gecomprimeerde string</returns> 412 + public static string CompressToBase64String(string content) { 413 + //string to byte[] 414 + byte[] contentArray = stringToByteArray(content); 415 + // Compress 416 + byte[] compressed = Compress(contentArray); 417 + return base64_encode(compressed); 418 + } 436 436 420 + /// <summary> 421 + /// Zet een string om naar een ByteArray 422 + /// </summary> 423 + /// <param name="content">filecontent</param> 424 + /// <returns>ByteArray</returns> 425 + public static byte[] stringToByteArray(string content) { 426 + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); 427 + return encoding.GetBytes(content); 428 + } 437 437 430 + /// <summary> 431 + /// comprimeer een ByteArray 432 + /// </summary> 433 + /// <param name="data">filedata als ByteArray</param> 434 + /// <returns>gecomprimeerde ByteArray</returns> 435 + public static byte[] Compress(byte[] data) { 436 + using(var compressedStream = new MemoryStream()) 437 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { 438 + zipStream.Write(data, 0, data.Length); 439 + zipStream.Close(); 440 + return compressedStream.ToArray(); 441 + } 442 + } 443 + 444 + /// <summary> 445 + /// Zet een ByteArray om naar een Base64 string 446 + /// </summary> 447 + /// <param name="data">gecomprimeerde ByteArray</param> 448 + /// <returns>Base 64 string</returns> 449 + public static string base64_encode(byte[] data) { 450 + if (data == null) 451 + return string.Empty; 452 + return Convert.ToBase64String(data); 453 + } 454 + 455 + /// <summary> 456 + /// Zet een string om naar een Base64 string 457 + /// </summary> 458 + /// <param name="data">string</param> 459 + /// <returns>Base 64 string</returns> 460 + public static string string_base64_encode(string data) { 461 + if (string.IsNullOrEmpty(data)) 462 + return string.Empty; 463 + 464 + //string to byte[] 465 + byte[] contentArray = stringToByteArray(data); 466 + return base64_encode(contentArray); 467 + } 468 + #endregion 469 + 470 + #region Decompress and decode 471 + // Decode and decompress 472 + /// <summary> 473 + /// Decomprimeer een Base64 string naar een string 474 + /// </summary> 475 + /// <param name="contentBase64">GZIP Base64 string</param> 476 + /// <returns>string</returns> 477 + public static string DecompressBase64StringToString(string contentBase64) { 478 + // Decompress 479 + byte[] decoded = base64_decode(contentBase64); 480 + byte[] decompressed = Decompress(decoded); 481 + 482 + return byteArrayTostring(decompressed); 483 + } 484 + 485 + /// <summary> 486 + /// Zet een ByteArray om in een normale string 487 + /// </summary> 488 + /// <param name="data">ByteArray</param> 489 + /// <returns>string</returns> 490 + public static string byteArrayTostring(byte[] data) { 491 + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 492 + return enc.GetString(data); 493 + } 494 + 495 + /// <summary> 496 + /// Zet een Base64 string om naar een ByteArray 497 + /// </summary> 498 + /// <param name="encodedData">Base64 string</param> 499 + /// <returns>gecomprimeerde ByteArray</returns> 500 + public static byte[] base64_decode(string encodedData) { 501 + byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); 502 + return encodedDataAsBytes; 503 + } 504 + 505 + /// <summary> 506 + /// Zet een gecomprimeerde ByteArray om in een ByteArray 507 + /// </summary> 508 + /// <param name="data">gecomprimeerde ByteArray</param> 509 + /// <returns>ByteArray (gedecomprimeerd)</returns> 510 + public static byte[] Decompress(byte[] data) { 511 + using(var compressedStream = new MemoryStream(data)) 512 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 513 + using(var resultStream = new MemoryStream()) { 514 + var buffer = new byte[4096]; 515 + int read; 516 + 517 + while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) { 518 + resultStream.Write(buffer, 0, read); 519 + } 520 + 521 + return resultStream.ToArray(); 522 + } 523 + } 524 + #endregion 525 +} 526 +{{/code}} 527 +))) 528 + 529 + 438 438 (% class="col-xs-12 col-sm-4" %) 439 439 ((( 440 440