<
From version < 10.1 >
edited by Robin Huisman
on 2023/05/23 13:17
To version < 15.5
edited by Robert Jan Daams
on 2025/03/05 18:02
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Setting up a Webservice connection for project exports
1 +Download a project (export)
Parent
... ... @@ -1,1 +1,1 @@
1 -Implementation documentation.WebHome
1 +Implementation documentation.For customers.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.RobinHuisman
1 +XWiki.RjDaams
Content
... ... @@ -40,7 +40,10 @@
40 40  We also have new REST Calls, with the same Input Output formats:
41 41  \\[[https:~~/~~/web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export>>https://web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export]]
42 42  
43 -HttpGet  or  HttpPost
43 +input as json: ExportRequest
44 +output as json: ExportResult
45 +
46 +as  POST  or  GET
44 44  {{/info}}
45 45  
46 46  == 1. Retreive all changed project from TerraIndex ==
... ... @@ -265,7 +265,7 @@
265 265  == 2. Retreive the project export from TerraIndex ==
266 266  
267 267  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.
268 -The format of the projectfile is documentated here: [[Documentation TerraIndex Export format - dsFieldProject.xsd>>Implementation documentation.Documentation TerraIndex Export format - dsFieldProject\.xsd.WebHome]]
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]]
269 269  
270 270  To start connecting this webservice, you should use this URL of the Import Export Webservice:
271 271  
... ... @@ -405,137 +405,7 @@
405 405  </soap:Envelope>
406 406  {{/code}}
407 407  
408 -
409 -== Zip Stream class ==
410 -
411 -If needed, this is the Zip Stream class you can use to extract the zipstream as used above:
412 -
413 -{{code language="Csharp" layout="LINENUMBERS"}}
414 -/// <summary>
415 -/// Helper class for compress en decompress of file data
416 -/// </summary>
417 -public static class ZipStreamHelper {
418 - #region Compress and encode
419 - /// <summary>
420 - /// Comprimeer een string en geeft deze terug in Base64 string.
421 - /// </summary>
422 - /// <param name="content">filecontent</param>
423 - /// <returns>gecomprimeerde string</returns>
424 - public static string CompressToBase64String(string content) {
425 - //string to byte[]
426 - byte[] contentArray = stringToByteArray(content);
427 - // Compress
428 - byte[] compressed = Compress(contentArray);
429 - return base64_encode(compressed);
430 - }
431 -
432 - /// <summary>
433 - /// Zet een string om naar een ByteArray
434 - /// </summary>
435 - /// <param name="content">filecontent</param>
436 - /// <returns>ByteArray</returns>
437 - public static byte[] stringToByteArray(string content) {
438 - System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
439 - return encoding.GetBytes(content);
440 - }
441 -
442 - /// <summary>
443 - /// comprimeer een ByteArray
444 - /// </summary>
445 - /// <param name="data">filedata als ByteArray</param>
446 - /// <returns>gecomprimeerde ByteArray</returns>
447 - public static byte[] Compress(byte[] data) {
448 - using(var compressedStream = new MemoryStream())
449 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) {
450 - zipStream.Write(data, 0, data.Length);
451 - zipStream.Close();
452 - return compressedStream.ToArray();
453 - }
454 - }
455 -
456 - /// <summary>
457 - /// Zet een ByteArray om naar een Base64 string
458 - /// </summary>
459 - /// <param name="data">gecomprimeerde ByteArray</param>
460 - /// <returns>Base 64 string</returns>
461 - public static string base64_encode(byte[] data) {
462 - if (data == null)
463 - return string.Empty;
464 - return Convert.ToBase64String(data);
465 - }
466 -
467 - /// <summary>
468 - /// Zet een string om naar een Base64 string
469 - /// </summary>
470 - /// <param name="data">string</param>
471 - /// <returns>Base 64 string</returns>
472 - public static string string_base64_encode(string data) {
473 - if (string.IsNullOrEmpty(data))
474 - return string.Empty;
475 -
476 - //string to byte[]
477 - byte[] contentArray = stringToByteArray(data);
478 - return base64_encode(contentArray);
479 - }
480 - #endregion
481 -
482 - #region Decompress and decode
483 - // Decode and decompress
484 - /// <summary>
485 - /// Decomprimeer een Base64 string naar een string
486 - /// </summary>
487 - /// <param name="contentBase64">GZIP Base64 string</param>
488 - /// <returns>string</returns>
489 - public static string DecompressBase64StringToString(string contentBase64) {
490 - // Decompress
491 - byte[] decoded = base64_decode(contentBase64);
492 - byte[] decompressed = Decompress(decoded);
493 -
494 - return byteArrayTostring(decompressed);
495 - }
496 -
497 - /// <summary>
498 - /// Zet een ByteArray om in een normale string
499 - /// </summary>
500 - /// <param name="data">ByteArray</param>
501 - /// <returns>string</returns>
502 - public static string byteArrayTostring(byte[] data) {
503 - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
504 - return enc.GetString(data);
505 - }
506 -
507 - /// <summary>
508 - /// Zet een Base64 string om naar een ByteArray
509 - /// </summary>
510 - /// <param name="encodedData">Base64 string</param>
511 - /// <returns>gecomprimeerde ByteArray</returns>
512 - public static byte[] base64_decode(string encodedData) {
513 - byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
514 - return encodedDataAsBytes;
515 - }
516 -
517 - /// <summary>
518 - /// Zet een gecomprimeerde ByteArray om in een ByteArray
519 - /// </summary>
520 - /// <param name="data">gecomprimeerde ByteArray</param>
521 - /// <returns>ByteArray (gedecomprimeerd)</returns>
522 - public static byte[] Decompress(byte[] data) {
523 - using(var compressedStream = new MemoryStream(data))
524 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
525 - using(var resultStream = new MemoryStream()) {
526 - var buffer = new byte[4096];
527 - int read;
528 -
529 - while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) {
530 - resultStream.Write(buffer, 0, read);
531 - }
532 -
533 - return resultStream.ToArray();
534 - }
535 - }
536 - #endregion
537 -}
538 -{{/code}}
411 +
539 539  )))
540 540  
541 541  
TerraIndex
asd