Changes for page Download a project (export)
Last modified by Robert Jan Daams on 2025/03/05 18:02
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,1 @@ 1 -Implementation documentation. For customers.WebHome1 +Implementation documentation.WebHome - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.R jDaams1 +XWiki.RobinHuisman - Content
-
... ... @@ -31,19 +31,15 @@ 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/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWS Externals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]]34 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx>>url:https://web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 35 35 ))) 36 36 37 37 == == 38 38 39 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 40 +This url also works; [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl>>url:https://web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx?wsdl]] 41 +\\We have updated our webservices from .asmx also to .svc, we recommend you to use the .svc version because it's safer and better. 42 +The requests and responses are the same, but the envelope might be slightly different. So create new proxy classes when switching from .asmx to .svc. 47 47 {{/info}} 48 48 49 49 == 1. Retreive all changed project from TerraIndex == ... ... @@ -268,7 +268,7 @@ 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]]267 +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 273 To start connecting this webservice, you should use this URL of the Import Export Webservice: 274 274 ... ... @@ -408,7 +408,137 @@ 408 408 </soap:Envelope> 409 409 {{/code}} 410 410 411 - 407 + 408 +== Zip Stream class == 409 + 410 +If needed, this is the Zip Stream class you can use to extract the zipstream as used above: 411 + 412 +{{code language="Csharp" layout="LINENUMBERS"}} 413 +/// <summary> 414 +/// Helper class for compress en decompress of file data 415 +/// </summary> 416 +public static class ZipStreamHelper { 417 + #region Compress and encode 418 + /// <summary> 419 + /// Comprimeer een string en geeft deze terug in Base64 string. 420 + /// </summary> 421 + /// <param name="content">filecontent</param> 422 + /// <returns>gecomprimeerde string</returns> 423 + public static string CompressToBase64String(string content) { 424 + //string to byte[] 425 + byte[] contentArray = stringToByteArray(content); 426 + // Compress 427 + byte[] compressed = Compress(contentArray); 428 + return base64_encode(compressed); 429 + } 430 + 431 + /// <summary> 432 + /// Zet een string om naar een ByteArray 433 + /// </summary> 434 + /// <param name="content">filecontent</param> 435 + /// <returns>ByteArray</returns> 436 + public static byte[] stringToByteArray(string content) { 437 + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); 438 + return encoding.GetBytes(content); 439 + } 440 + 441 + /// <summary> 442 + /// comprimeer een ByteArray 443 + /// </summary> 444 + /// <param name="data">filedata als ByteArray</param> 445 + /// <returns>gecomprimeerde ByteArray</returns> 446 + public static byte[] Compress(byte[] data) { 447 + using(var compressedStream = new MemoryStream()) 448 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { 449 + zipStream.Write(data, 0, data.Length); 450 + zipStream.Close(); 451 + return compressedStream.ToArray(); 452 + } 453 + } 454 + 455 + /// <summary> 456 + /// Zet een ByteArray om naar een Base64 string 457 + /// </summary> 458 + /// <param name="data">gecomprimeerde ByteArray</param> 459 + /// <returns>Base 64 string</returns> 460 + public static string base64_encode(byte[] data) { 461 + if (data == null) 462 + return string.Empty; 463 + return Convert.ToBase64String(data); 464 + } 465 + 466 + /// <summary> 467 + /// Zet een string om naar een Base64 string 468 + /// </summary> 469 + /// <param name="data">string</param> 470 + /// <returns>Base 64 string</returns> 471 + public static string string_base64_encode(string data) { 472 + if (string.IsNullOrEmpty(data)) 473 + return string.Empty; 474 + 475 + //string to byte[] 476 + byte[] contentArray = stringToByteArray(data); 477 + return base64_encode(contentArray); 478 + } 479 + #endregion 480 + 481 + #region Decompress and decode 482 + // Decode and decompress 483 + /// <summary> 484 + /// Decomprimeer een Base64 string naar een string 485 + /// </summary> 486 + /// <param name="contentBase64">GZIP Base64 string</param> 487 + /// <returns>string</returns> 488 + public static string DecompressBase64StringToString(string contentBase64) { 489 + // Decompress 490 + byte[] decoded = base64_decode(contentBase64); 491 + byte[] decompressed = Decompress(decoded); 492 + 493 + return byteArrayTostring(decompressed); 494 + } 495 + 496 + /// <summary> 497 + /// Zet een ByteArray om in een normale string 498 + /// </summary> 499 + /// <param name="data">ByteArray</param> 500 + /// <returns>string</returns> 501 + public static string byteArrayTostring(byte[] data) { 502 + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 503 + return enc.GetString(data); 504 + } 505 + 506 + /// <summary> 507 + /// Zet een Base64 string om naar een ByteArray 508 + /// </summary> 509 + /// <param name="encodedData">Base64 string</param> 510 + /// <returns>gecomprimeerde ByteArray</returns> 511 + public static byte[] base64_decode(string encodedData) { 512 + byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); 513 + return encodedDataAsBytes; 514 + } 515 + 516 + /// <summary> 517 + /// Zet een gecomprimeerde ByteArray om in een ByteArray 518 + /// </summary> 519 + /// <param name="data">gecomprimeerde ByteArray</param> 520 + /// <returns>ByteArray (gedecomprimeerd)</returns> 521 + public static byte[] Decompress(byte[] data) { 522 + using(var compressedStream = new MemoryStream(data)) 523 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 524 + using(var resultStream = new MemoryStream()) { 525 + var buffer = new byte[4096]; 526 + int read; 527 + 528 + while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) { 529 + resultStream.Write(buffer, 0, read); 530 + } 531 + 532 + return resultStream.ToArray(); 533 + } 534 + } 535 + #endregion 536 +} 537 +{{/code}} 412 412 ))) 413 413 414 414