Last modified by Nico Lemaire on 2025/09/01 13:36

From version 6.2
edited by Robert Jan Daams
on 2022/08/23 11:14
Change comment: There is no comment for this version
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
Content
... ... @@ -23,12 +23,29 @@
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}}|[[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]]
26 +|**Old**|{{code language="none"}}https://web.terraindex.com/DataWS/{{/code}}|(((
27 +[[https:~~/~~/web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON]]
28 28  
29 -(% class="wikigeneratedid" %)
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 +
30 30  == ==
31 31  
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 +
32 32  == 1. Retreive all changed project from TerraIndex ==
33 33  
34 34  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.
... ... @@ -35,7 +35,7 @@
35 35  This way you only download projects that have changes, and it will not request project that are not needed, so it won’t keep our servers busy with exports that are not necessary.
36 36  
37 37  To start connecting this webservice, you should use this URL:
38 -[[https:~~/~~/web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON>>url:https://web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON]]
55 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]]
39 39  
40 40  Fill the **Body **of a **POST **HTTP call with:
41 41  
... ... @@ -251,11 +251,12 @@
251 251  == 2. Retreive the project export from TerraIndex ==
252 252  
253 253  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.
254 -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]]
255 255  
256 -To start connecting this webservice, you should use this URL of the Import Export Webservice:
257 -[[https:~~/~~/web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx>>url:https://web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx]]
273 +To start connecting this webservice, you should use this URL of the Import Export Webservice:
258 258  
275 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]]
276 +
259 259  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.
260 260  
261 261  [[image:image-20200108-123431.png]]
... ... @@ -390,137 +390,7 @@
390 390  </soap:Envelope>
391 391  {{/code}}
392 392  
393 -
394 -== Zip Stream class ==
395 -
396 -If needed, this is the Zip Stream class you can use to extract the zipstream as used above:
397 -
398 -{{code language="Csharp" layout="LINENUMBERS"}}
399 -/// <summary>
400 -/// Helper class for compress en decompress of file data
401 -/// </summary>
402 -public static class ZipStreamHelper {
403 - #region Compress and encode
404 - /// <summary>
405 - /// Comprimeer een string en geeft deze terug in Base64 string.
406 - /// </summary>
407 - /// <param name="content">filecontent</param>
408 - /// <returns>gecomprimeerde string</returns>
409 - public static string CompressToBase64String(string content) {
410 - //string to byte[]
411 - byte[] contentArray = stringToByteArray(content);
412 - // Compress
413 - byte[] compressed = Compress(contentArray);
414 - return base64_encode(compressed);
415 - }
416 -
417 - /// <summary>
418 - /// Zet een string om naar een ByteArray
419 - /// </summary>
420 - /// <param name="content">filecontent</param>
421 - /// <returns>ByteArray</returns>
422 - public static byte[] stringToByteArray(string content) {
423 - System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
424 - return encoding.GetBytes(content);
425 - }
426 -
427 - /// <summary>
428 - /// comprimeer een ByteArray
429 - /// </summary>
430 - /// <param name="data">filedata als ByteArray</param>
431 - /// <returns>gecomprimeerde ByteArray</returns>
432 - public static byte[] Compress(byte[] data) {
433 - using(var compressedStream = new MemoryStream())
434 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) {
435 - zipStream.Write(data, 0, data.Length);
436 - zipStream.Close();
437 - return compressedStream.ToArray();
438 - }
439 - }
440 -
441 - /// <summary>
442 - /// Zet een ByteArray om naar een Base64 string
443 - /// </summary>
444 - /// <param name="data">gecomprimeerde ByteArray</param>
445 - /// <returns>Base 64 string</returns>
446 - public static string base64_encode(byte[] data) {
447 - if (data == null)
448 - return string.Empty;
449 - return Convert.ToBase64String(data);
450 - }
451 -
452 - /// <summary>
453 - /// Zet een string om naar een Base64 string
454 - /// </summary>
455 - /// <param name="data">string</param>
456 - /// <returns>Base 64 string</returns>
457 - public static string string_base64_encode(string data) {
458 - if (string.IsNullOrEmpty(data))
459 - return string.Empty;
460 -
461 - //string to byte[]
462 - byte[] contentArray = stringToByteArray(data);
463 - return base64_encode(contentArray);
464 - }
465 - #endregion
466 -
467 - #region Decompress and decode
468 - // Decode and decompress
469 - /// <summary>
470 - /// Decomprimeer een Base64 string naar een string
471 - /// </summary>
472 - /// <param name="contentBase64">GZIP Base64 string</param>
473 - /// <returns>string</returns>
474 - public static string DecompressBase64StringToString(string contentBase64) {
475 - // Decompress
476 - byte[] decoded = base64_decode(contentBase64);
477 - byte[] decompressed = Decompress(decoded);
478 -
479 - return byteArrayTostring(decompressed);
480 - }
481 -
482 - /// <summary>
483 - /// Zet een ByteArray om in een normale string
484 - /// </summary>
485 - /// <param name="data">ByteArray</param>
486 - /// <returns>string</returns>
487 - public static string byteArrayTostring(byte[] data) {
488 - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
489 - return enc.GetString(data);
490 - }
491 -
492 - /// <summary>
493 - /// Zet een Base64 string om naar een ByteArray
494 - /// </summary>
495 - /// <param name="encodedData">Base64 string</param>
496 - /// <returns>gecomprimeerde ByteArray</returns>
497 - public static byte[] base64_decode(string encodedData) {
498 - byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
499 - return encodedDataAsBytes;
500 - }
501 -
502 - /// <summary>
503 - /// Zet een gecomprimeerde ByteArray om in een ByteArray
504 - /// </summary>
505 - /// <param name="data">gecomprimeerde ByteArray</param>
506 - /// <returns>ByteArray (gedecomprimeerd)</returns>
507 - public static byte[] Decompress(byte[] data) {
508 - using(var compressedStream = new MemoryStream(data))
509 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
510 - using(var resultStream = new MemoryStream()) {
511 - var buffer = new byte[4096];
512 - int read;
513 -
514 - while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) {
515 - resultStream.Write(buffer, 0, read);
516 - }
517 -
518 - return resultStream.ToArray();
519 - }
520 - }
521 - #endregion
522 -}
523 -{{/code}}
411 +
524 524  )))
525 525  
526 526