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

From version 3.1
edited by Roelof Zwaan
on 2021/11/23 11:40
Change comment: Renamed from xwiki:Implementatie dcoumentatie.Setting up a Webservice connection for project exports.WebHome
To version 15.6
edited by Nico Lemaire
on 2025/09/01 13:36
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 -Implementatie dcoumentatie.WebHome
1 +Implementation documentation.For customers.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.RoelofZwaan
1 +XWiki.NicoLemaire
Content
... ... @@ -16,6 +16,36 @@
16 16  (((
17 17  (% class="col-xs-12 col-sm-8" %)
18 18  (((
19 +== Changelog ==
20 +
21 +=== Update 2022-08-23 ===
22 +
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 +
25 +| |**URL**|
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 +
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 +== ==
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 +
19 19  == 1. Retreive all changed project from TerraIndex ==
20 20  
21 21  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.
... ... @@ -22,7 +22,7 @@
22 22  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.
23 23  
24 24  To start connecting this webservice, you should use this URL:
25 -[[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]]
26 26  
27 27  Fill the **Body **of a **POST **HTTP call with:
28 28  
... ... @@ -36,7 +36,7 @@
36 36   "Language": "en"
37 37   },
38 38   "LanguageCode": "en",
39 - "WebserviceVersion": 1,
69 + "WebserviceVersion": "1.0",
40 40   "SearchFilter": "",
41 41   "ArchiveID": 0,
42 42   "PageSize": 30,
... ... @@ -238,11 +238,12 @@
238 238  == 2. Retreive the project export from TerraIndex ==
239 239  
240 240  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.
241 -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]]
242 242  
243 -To start connecting this webservice, you should use this URL of the Import Export Webservice:
244 -[[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:
245 245  
275 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]]
276 +
246 246  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.
247 247  
248 248  [[image:image-20200108-123431.png]]
... ... @@ -256,12 +256,16 @@
256 256  Also fill the license and the applicationCode. //(These two fields can be requested at the TerraIndex Servicedesk.)//
257 257  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.
258 258  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//
259 259  6; Fill the parameter with the FileName.
260 260  7; Fill the parameter with **projectID**. Instead of ‘ProjectID' it’s also possible to fill the parameter ‘ProjectCode'.
261 261  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.
262 262  9; The response field 'Filecontent’is filled if it went OK, and it contains XML you can serialize.
263 -\\*Username and password are known by each TI user and the application manager of your company can create new usernames.
296 +10; an extra parameter is added calles: **UseZipStream**. The result data is default Base64 encoded, if you add UseZipStream = true, the result string is GZIPSTREAMED Base64 encoded. **At the end of this page, we have added an class as code, to parse the base64 or ZIPStream Base64 to a normal string.**
297 +*Username and password are known by each TI user and the application manager of your company can create new usernames.
264 264  
299 +
265 265  **EXAMPLE CODE**
266 266  
267 267  ExportType:
... ... @@ -307,7 +307,7 @@
307 307  <soapenv:Envelope
308 308   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
309 309   xmlns:itw="https://wsterraindex.terraindex.com/ITWorks.TerraIndex/">
310 - <soapenv:Header/>
345 + <soapenv:Header></soapenv:Header>
311 311   <soapenv:Body>
312 312   <itw:Export>
313 313   <itw:request>
... ... @@ -375,139 +375,31 @@
375 375  {{/code}}
376 376  
377 377  
378 -== Zip Stream class ==
413 +**List of export types:**
379 379  
380 -If needed, this is the Zip Stream class you can use to extract the zipstream as used above:
381 -
382 -{{code language="Csharp" layout="LINENUMBERS"}}
383 -/// <summary>
384 -/// Helper class for compress en decompress of file data
385 -/// </summary>
386 -public static class ZipStreamHelper {
387 - #region Compress and encode
388 - /// <summary>
389 - /// Comprimeer een string en geeft deze terug in Base64 string.
390 - /// </summary>
391 - /// <param name="content">filecontent</param>
392 - /// <returns>gecomprimeerde string</returns>
393 - public static string CompressToBase64String(string content) {
394 - //string to byte[]
395 - byte[] contentArray = stringToByteArray(content);
396 - // Compress
397 - byte[] compressed = Compress(contentArray);
398 - return base64_encode(compressed);
399 - }
400 -
401 - /// <summary>
402 - /// Zet een string om naar een ByteArray
403 - /// </summary>
404 - /// <param name="content">filecontent</param>
405 - /// <returns>ByteArray</returns>
406 - public static byte[] stringToByteArray(string content) {
407 - System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
408 - return encoding.GetBytes(content);
409 - }
410 -
411 - /// <summary>
412 - /// comprimeer een ByteArray
413 - /// </summary>
414 - /// <param name="data">filedata als ByteArray</param>
415 - /// <returns>gecomprimeerde ByteArray</returns>
416 - public static byte[] Compress(byte[] data) {
417 - using(var compressedStream = new MemoryStream())
418 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) {
419 - zipStream.Write(data, 0, data.Length);
420 - zipStream.Close();
421 - return compressedStream.ToArray();
422 - }
423 - }
424 -
425 - /// <summary>
426 - /// Zet een ByteArray om naar een Base64 string
427 - /// </summary>
428 - /// <param name="data">gecomprimeerde ByteArray</param>
429 - /// <returns>Base 64 string</returns>
430 - public static string base64_encode(byte[] data) {
431 - if (data == null)
432 - return string.Empty;
433 - return Convert.ToBase64String(data);
434 - }
435 -
436 - /// <summary>
437 - /// Zet een string om naar een Base64 string
438 - /// </summary>
439 - /// <param name="data">string</param>
440 - /// <returns>Base 64 string</returns>
441 - public static string string_base64_encode(string data) {
442 - if (string.IsNullOrEmpty(data))
443 - return string.Empty;
444 -
445 - //string to byte[]
446 - byte[] contentArray = stringToByteArray(data);
447 - return base64_encode(contentArray);
448 - }
449 - #endregion
450 -
451 - #region Decompress and decode
452 - // Decode and decompress
453 - /// <summary>
454 - /// Decomprimeer een Base64 string naar een string
455 - /// </summary>
456 - /// <param name="contentBase64">GZIP Base64 string</param>
457 - /// <returns>string</returns>
458 - public static string DecompressBase64StringToString(string contentBase64) {
459 - // Decompress
460 - byte[] decoded = base64_decode(contentBase64);
461 - byte[] decompressed = Decompress(decoded);
462 -
463 - return byteArrayTostring(decompressed);
464 - }
465 -
466 - /// <summary>
467 - /// Zet een ByteArray om in een normale string
468 - /// </summary>
469 - /// <param name="data">ByteArray</param>
470 - /// <returns>string</returns>
471 - public static string byteArrayTostring(byte[] data) {
472 - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
473 - return enc.GetString(data);
474 - }
475 -
476 - /// <summary>
477 - /// Zet een Base64 string om naar een ByteArray
478 - /// </summary>
479 - /// <param name="encodedData">Base64 string</param>
480 - /// <returns>gecomprimeerde ByteArray</returns>
481 - public static byte[] base64_decode(string encodedData) {
482 - byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
483 - return encodedDataAsBytes;
484 - }
485 -
486 - /// <summary>
487 - /// Zet een gecomprimeerde ByteArray om in een ByteArray
488 - /// </summary>
489 - /// <param name="data">gecomprimeerde ByteArray</param>
490 - /// <returns>ByteArray (gedecomprimeerd)</returns>
491 - public static byte[] Decompress(byte[] data) {
492 - using(var compressedStream = new MemoryStream(data))
493 - using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
494 - using(var resultStream = new MemoryStream()) {
495 - var buffer = new byte[4096];
496 - int read;
497 -
498 - while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) {
499 - resultStream.Write(buffer, 0, read);
500 - }
501 -
502 - return resultStream.ToArray();
503 - }
504 - }
505 - #endregion
506 -}
507 -{{/code}}
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
508 508  )))
509 509  
510 510  
437 +
511 511  (% class="col-xs-12 col-sm-4" %)
512 512  (((
513 513