Last modified by Nico Lemaire on 2025/05/06 15:49

From version 22.2
edited by Robin Huisman
on 2024/09/06 11:26
Change comment: There is no comment for this version
To version 26.5
edited by Nico Lemaire
on 2025/05/06 15:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Setting up Lab communication by REST services with TerraIndex
1 +Setting up API communication by REST services with TerraIndex for laboratories
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.RobinHuisman
1 +XWiki.NicoLemaire
Content
... ... @@ -34,37 +34,41 @@
34 34  Our IP-addresses:
35 35  
36 36  (% element-id="1881" %)
37 -inbound [[Web.terraindex.com>>url:http://Web.terraindex.com||element-id="1880"]]
37 +__**inbound [[Web.terraindex.com>>url:http://Web.terraindex.com||element-id="1880"]]**__
38 38  137.116.199.164
39 39  
40 40  (% element-id="1878" %)
41 -outbound [[Test.terraindex.com>>url:http://Test.terraindex.com||element-id="1877"]]
41 +__**outbound [[Test.terraindex.com>>url:http://Test.terraindex.com||element-id="1877"]]**__
42 42  104.45.9.128
43 43  
44 44  (% element-id="1875" %)
45 -Production outbound
45 +__**Production outbound (http)**__
46 46  40.115.34.64
47 47  
48 -Production outbound (ftp):
48 +__**Production outbound (ftp):**__
49 49  
50 -20.54.163.29, 20.54.163.30, 20.54.163.34, 20.54.163.36, 20.54.163.43, 20.50.134.53, 20.54.163.47, 20.54.163.57, 20.54.163.61, 20.54.163.68, 20.54.163.76, 20.54.163.79, 51.105.111.203, 20.50.147.106, 20.50.148.51, 20.50.148.60, 20.50.146.193, 20.50.148.123, 20.50.148.128, 20.50.148.159, 51.138.21.31, 20.50.148.164, 20.50.148.172, 51.105.105.244, 20.54.163.90, 20.54.163.94, 20.54.163.100, 20.73.28.18, 20.73.28.145, 20.73.29.144, 20.50.2.9
50 +13.93.123.234
51 51  
52 52  (% element-id="1873" %)
53 -Test outbound
53 +__**Test outbound (http, ftp)**__
54 54  13.73.138.173
55 55  
56 -Test outbound (ftp):
56 +__**Test outbound (ftp: eurofins, eurofins spain):**__
57 57  
58 -51.138.62.216, 51.138.62.232, 51.138.62.241, 51.138.63.1, 51.138.63.19, 51.138.63.30, 51.138.63.43, 51.137.2.110, 51.138.63.49, 51.138.63.70, 51.138.63.82, 51.138.63.94, 51.138.63.102, 51.105.249.46, 51.137.7.98, 51.138.63.17, 51.137.6.51, 51.138.63.159, 51.138.63.175, 51.138.63.189, 51.138.63.234, 20.61.224.11, 20.61.224.20, 20.61.224.37, 20.61.224.50, 52.236.158.189, 52.236.159.215, 52.157.223.174, 52.157.223.203, 40.74.33.17, 20.50.2.44
58 +51.145.244.12
59 59  
60 60  (% element-id="1871" %)
61 -CD/CI outbound
61 +__**CD/CI outbound**__
62 62  40.114.238.16
63 63  
64 64  (% element-id="1869" %)
65 -Office outbound
65 +__**Office outbound**__
66 66  213.124.115.132
67 67  
68 +(% element-id="1869" %)
69 +__**Deliveryservice**__
70 +Production: 13.93.123.234
71 +Test: 51.145.244.12
68 68  
69 69  (% element-id="1864" %)
70 70  = (% element-id="1863" %)Labdelivery (menu-card) files Exchange(%%) =
... ... @@ -1257,7 +1257,7 @@
1257 1257  )))
1258 1258  
1259 1259  (% element-id="654" %)
1260 -= (% element-id="653" %)Get Order status and Results(%%) =
1264 += (% element-id="653" %)Get Order status and Results XML and with PDF(%%) =
1261 1261  
1262 1262  (% element-id="652" %)
1263 1263  == (% element-id="651" %)Solution/Design(%%) ==
... ... @@ -1396,7 +1396,7 @@
1396 1396  10 = PDFNotAvailable
1397 1397  (% element-id="370" %)|(% element-id="369" %)12|(% element-id="368" %)Receives the PDF and stores it for reporting and downloading.|(% element-id="367" %) |(% element-id="365" %) |(% element-id="363" %) |(% element-id="361" %) |(% element-id="359" %)
1398 1398  
1399 -(% class="wikigeneratedid" element-id="357" %)
1403 +(% element-id="357" %)
1400 1400  == Request example Order Status ==
1401 1401  
1402 1402  public GetOrderStatusesCall.Response OrderStatuses(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, DateTime? timestampSince)
... ... @@ -1430,7 +1430,7 @@
1430 1430   {
1431 1431   XmlSerializer serializer = new XmlSerializer(typeof(GetOrderStatusesCall.Response));
1432 1432   set = (GetOrderStatusesCall.Response)serializer.Deserialize(ms);
1433 - }
1437 + }               
1434 1434  
1435 1435   }
1436 1436   catch (Exception ex)
... ... @@ -1454,11 +1454,11 @@
1454 1454   }
1455 1455  
1456 1456   return set;
1457 - }
1461 + }       
1458 1458  
1459 -== Response XML Example ==
1463 +== Response Status XML Example ==
1460 1460  
1461 -<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1465 + <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1462 1462   <Response>
1463 1463   <Orders>
1464 1464   <Order>
... ... @@ -1507,7 +1507,129 @@
1507 1507   </Response>
1508 1508  
1509 1509  
1514 +== Request example Order XML ==
1510 1510  
1516 +
1517 +public GetOrderResultsCall.Response GetOrderResults(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, string orderid, string sikbVersion)
1518 + {
1519 + GetOrderResultsCall.Response set = new GetOrderResultsCall.Response();
1520 + string responseMessage = null;
1521 + try
1522 + {
1523 + bool useZipstream = true;
1524 + var content = new FormUrlEncodedContent(new[]
1525 + {
1526 + new KeyValuePair<string, string>("userName", WebserviceUsername),
1527 + new KeyValuePair<string, string>("password", WebservicePassword),
1528 + new KeyValuePair<string, string>("customerUsername", CustomerUsername),
1529 + new KeyValuePair<string, string>("clientId", customerid),
1530 + new KeyValuePair<string, string>("orderId", orderid),
1531 + new KeyValuePair<string, string>("sikbVersion", sikbVersion),
1532 + new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
1533 + });
1534 +
1535 + HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetOrderResults", content).GetAwaiter().GetResult();
1536 + responseMessage = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
1537 + response.EnsureSuccessStatusCode();
1538 +
1539 + if (string.IsNullOrEmpty(responseMessage))
1540 + {
1541 + throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetOrderResults" + "]");
1542 + }
1543 + using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
1544 + {
1545 + XmlSerializer serializer = new XmlSerializer(typeof(GetOrderResultsCall.Response));
1546 + set = (GetOrderResultsCall.Response)serializer.Deserialize(ms);
1547 + }
1548 +
1549 + if (useZipstream && !string.IsNullOrEmpty(set.FileContent))
1550 + {
1551 + ~/~/convert from base64 string back to normal
1552 + ~/~/first check for real Base64, by checking there is no 'xml' in it
1553 + ~/~/If encoded, it wont contain either of the root XML tags of SIKB
1554 + if (!set.FileContent.Contains("FeatureCollectionIMSIKB0101") && !set.FileContent.Contains("labresultaat"))
1555 + {
1556 + set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);
1557 + }
1558 + }
1559 +
1560 + }
1561 + catch (Exception ex)
1562 + {
1563 + #region handle exception
1564 +
1565 + set.Status = new BusinessEntities.LabRestService.GetOrderResultsCall.ResponseStatus();
1566 + set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1567 + set.Status.ErrorMessage = "Exception occurred in GetOrderResults (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.ToString();
1568 +
1569 + ex.Data.Add("Response", responseMessage);
1570 + ex.Data.Add("WebserviceUsername", WebserviceUsername);
1571 + ex.Data.Add("WebservicePassword", WebservicePassword);
1572 + ex.Data.Add("CustomerUsername", CustomerUsername);
1573 + ex.Data.Add("sikbVersion", sikbVersion);
1574 + ex.Data.Add("customerid", customerid);
1575 + ex.Data.Add("orderId", orderid);
1576 + ex.Data.Add("Result", set);
1577 +
1578 + throw;
1579 + #endregion
1580 + }
1581 +
1582 + return set;
1583 +
1584 +
1585 +== Response Order XML Example ==
1586 +
1587 +
1588 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1589 + <Response>
1590 + <FileContent>DhVn3Q1AA==</FileContent>  ~/~/BASE64 Zip Stream, SIKB0101 labresults xml file
1591 + <Status>
1592 + <StatusCode>1</StatusCode>
1593 + <StatusCodeDescription>OK</StatusCodeDescription>
1594 + <AtmisErrorCode>0</AtmisErrorCode>  
1595 + <ErrorMessage></ErrorMessage>
1596 + </Status>
1597 + </Response>
1598 +
1599 +
1600 +== Request example Order PDF File ==
1601 +
1602 +
1603 +
1604 + bool useZipstream = true; ~/~/ Always Supported, Keep it true!!
1605 + var content = new FormUrlEncodedContent(new[]
1606 + {
1607 + new KeyValuePair<string, string>("userName", WebserviceUsername),
1608 + new KeyValuePair<string, string>("password", WebservicePassword),
1609 + new KeyValuePair<string, string>("customerUsername", CustomerUsername),
1610 + new KeyValuePair<string, string>("clientId", customerid),
1611 + new KeyValuePair<string, string>("orderId", orderid),
1612 + new KeyValuePair<string, string>("useZip", useZipstream.ToString()), ~/~/ Always Supported, Keep it true!!.
1613 + new KeyValuePair<string, string>("languageCode", languageCode)
1614 + });
1615 +
1616 + HttpResponseMessage response = _HttpClient.PostAsync("GetOrderPdf", content).GetAwaiter().GetResult();
1617 + responseMessage = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
1618 + response.EnsureSuccessStatusCode();
1619 +
1620 +
1621 +== Response Order PDF Example ==
1622 +
1623 + <Response>
1624 + <OrderId>7113737</OrderId>
1625 + <FileContent>
1626 + BASE64 encoded file
1627 + </FileContent>
1628 + <Status>
1629 + <StatusCode>1</StatusCode>
1630 + <StatusCodeDescription>OK</StatusCodeDescription>
1631 + <ErrorMessage></ErrorMessage>
1632 + </Status>
1633 + </Response>
1634 +
1635 +
1636 +
1511 1511  (% element-id="357" %)
1512 1512  = (% element-id="356" %)Customer wants to see real time information about the status in the interface(%%) =
1513 1513