Version 23.3 by Robin Huisman on 2024/10/10 10:21

Show last authors
1 {{toc/}}
2
3
4 = Digital Lab Exchange process =
5
6 The flow diagram gives a small overview of what the data flow of a lab assignment is.
7 Every block shows a step of the lab assignment process. From top to bottom these steps are:
8
9 1. Showing the laboratory and all the analyses that can be requested as an option to the user.
10 1. The user creating a lab assignment and sending it to the lab trough TerraIndex.
11 1. The lab delivering the analysis results back to the TerraIndex.
12
13 [[attach:Lab exchange.svg||rel="noopener noreferrer" target="_blank"]] [[attach:Lab exchange.txt||rel="noopener noreferrer" target="_blank"]]
14
15 [[image:1712326465681-980.png||height="315" width="630"]]
16
17
18 [[image:1712326492306-381.png||height="781" width="635"]]
19
20 ~==> TODO; add option to confirm order based on the Order price PDF
21
22
23 [[image:1712326520488-924.png||height="312" width="632"]]
24
25 ~==> TODO; add option download labcertificate
26
27 (% element-id="1884" %)
28 = =
29
30 (% element-id="1884" %)
31 = (% element-id="1883" %)Firewall IP-Addresses of TerraIndex(%%) =
32
33 (% element-id="1882" %)
34 Our IP-addresses:
35
36 (% element-id="1881" %)
37 inbound [[Web.terraindex.com>>url:http://Web.terraindex.com||element-id="1880"]]
38 137.116.199.164
39
40 (% element-id="1878" %)
41 outbound [[Test.terraindex.com>>url:http://Test.terraindex.com||element-id="1877"]]
42 104.45.9.128
43
44 (% element-id="1875" %)
45 Production outbound
46 40.115.34.64
47
48 Production outbound (ftp):
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
51
52 (% element-id="1873" %)
53 Test outbound
54 13.73.138.173
55
56 Test outbound (ftp):
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
59
60 (% element-id="1871" %)
61 CD/CI outbound
62 40.114.238.16
63
64 (% element-id="1869" %)
65 Office outbound
66 213.124.115.132
67
68
69 (% element-id="1864" %)
70 = (% element-id="1863" %)Labdelivery (menu-card) files Exchange(%%) =
71
72 (% element-id="1862" %)
73 == (% element-id="1861" %)Solution/Design(%%) ==
74
75
76 (% class="table-hover" element-id="1858" %)
77 (% element-id="1856" %)|(% element-id="1855" %)(% element-id="1854" %)**Action**|(% element-id="1853" %)(% element-id="1852" %)**TerraIndex**|(% element-id="1851" %) |(% element-id="1849" %)(% element-id="1848" %)**Laboratorium**|(% element-id="1847" %)(% element-id="1846" %)**Parameters/Message**|(% element-id="1845" %)(% element-id="1844" %)**Remarks**|(% element-id="1843" %)(% element-id="1842" %)**ResultCodes**
78 (% element-id="1841" %)|(% element-id="1840" %)1|(% element-id="1839" %)Sends a request to the function: GetCustomers().|=(% element-id="1838" %)>|(% element-id="1837" %) |(% element-id="1835" %)(% element-id="1834" %)**WebserviceUsername (string), **(%%)
79 (% element-id="1832" %)**WebservicePassword (string),**(%%)
80 (% element-id="1830" %)**CustomerUsername (string)**|(% element-id="1829" %) |(% element-id="1827" %)
81 (% element-id="1825" %)|(% element-id="1824" %)2|(% element-id="1823" %) |(% element-id="1821" %) |(% element-id="1819" %)Receives the request and check the customers this username and searches the dateLastChanged for this Customer.|(% element-id="1818" %) |(% element-id="1816" %) |(% element-id="1814" %)
82 (% element-id="1812" %)|(% element-id="1811" %)3|(% element-id="1810" %) |(% element-id="1808" %)<=|(% element-id="1807" %)Sends back the list of customers with the lastChangedTimestamp|(% element-id="1806" %)ResultCode (),
83 ErrorMessage (string),
84 List<customer> , Customer:
85 CustomerCode (string),
86 CustomerName (string),
87 LabID (int),
88 LabName (string),
89 ChangedTimeStamp (DateTime)|(% element-id="1798" %)We receive the dateTimestamp instead of sending it, so we always get the full list and we are also able to delete customercodes.|(% element-id="1797" %)1 = Success,
90 2 = GeneralError,
91 3 = WrongSIKBVersion,
92 4 = InvalidCredentials,
93 5 = CustomerUsernameInvalid,
94 6 = CustomerUsernameNotValidForCustomerCode
95 7 = FileContentProblem,
96 8 = InvalidOrderId,
97 9 = OrderIdAlreadyApproved
98 10 = PDFNotAvailable
99 (% element-id="1787" %)|(% element-id="1786" %)4|(% element-id="1785" %)Receives the list of Customers, and will check for each customer it needs to request a new/changed labdelivery file based on the ChangedTimestamp.|(% element-id="1784" %) |(% element-id="1782" %) |(% element-id="1780" %) |(% element-id="1778" %)If a customer is not longer in this list, TerraIndex can remove this customercode from the customer database.|(% element-id="1777" %)
100 (% element-id="1775" %)|(% element-id="1774" %)5|(% element-id="1773" %)Sends a request to the function: GetProductList() if it has changed.|=(% element-id="1772" %)>|(% element-id="1771" %) |(% element-id="1769" %)(% element-id="1768" %)**WebserviceUsername (string), **(%%)
101 (% element-id="1766" %)**WebservicePassword (string),**(%%)
102 (% element-id="1764" %)**CustomerUsername (string),**(%%)
103 LabID (int),
104 CustomerCode (string),
105 LanguageCode (string, default 'nld' volgens ISO 639-3-codes),
106 SIKBVersion (string, default: '13.4.0'),
107 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1758" %)(% element-id="1757" %)
108 (((
109 (% element-id="1756" %)
110 We start with dutch, then extend with multiple languages, TerraIndex is in the lead to request multiple languages.
111 TerraIndex uses: 'fra', 'nld', 'eng', 'spa', 'deu', 'ita', 'por', 'dan'
112
113
114 (% element-id="1752" %)
115 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0/8.0.0 etc.
116
117 (% element-id="1752" %)
118 ~==> nle Do you want to mention these old versions?
119 )))|(% element-id="1751" %)
120 (% element-id="1749" %)|(% element-id="1748" %)6|(% element-id="1747" %) |(% element-id="1745" %) |(% element-id="1743" %)Reveives a request to create a labdelivery file in a certain version of SIKB. It will generate the file.|(% element-id="1742" %) |(% element-id="1740" %) |(% element-id="1738" %)
121 (% element-id="1736" %)|(% element-id="1735" %)7|(% element-id="1734" %) |(% element-id="1732" %)<=|(% element-id="1731" %)Sends back the SIKB file, as a Base64 encoded string, with or without using a zipstream.|(% element-id="1730" %)ResultCode (),
122 ErrorMessage (string),
123 FileContent_Base64 (string),
124 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1726" %) |(% element-id="1724" %)1 = Success,
125 2 = GeneralError,
126 3 = WrongSIKBVersion,
127 4 = InvalidCredentials,
128 5 = CustomerUsernameInvalid,
129 6 = CustomerUsernameNotValidForCustomerCode
130 7 = FileContentProblem,
131 8 = InvalidOrderId,
132 9 = OrderIdAlreadyApproved
133 10 = PDFNotAvailable
134 (% element-id="1714" %)|(% element-id="1713" %)8|(% element-id="1712" %)Receives the DeliveryFile and saves the file for import into customer database.|(% element-id="1711" %) |(% element-id="1709" %) |(% element-id="1707" %) |(% element-id="1705" %) |(% element-id="1703" %)
135 (% element-id="1701" %)|(% element-id="1700" %)9|(% element-id="1699" %)Go back to step 5, for every Customer code, every language.|(% element-id="1698" %) |(% element-id="1696" %) |(% element-id="1694" %) |(% element-id="1692" %) |(% element-id="1690" %)
136 (% element-id="1688" %)|(% element-id="1687" %)10|(% element-id="1686" %)Process the LabDeliveryFiles|(% element-id="1685" %) |(% element-id="1683" %) |(% element-id="1681" %) |(% element-id="1679" %) |(% element-id="1677" %)
137
138 (% element-id="1675" %)
139 == (% element-id="1674" %)Get Customers (POST)(%%) ==
140
141 (% element-id="1673" %)
142 === (% element-id="1672" %)Request example(%%) ===
143
144 (% element-id="1671" %)
145 (% element-id="1669" %)|(% element-id="1668" %)(% element-id="1667" %)
146 (((
147 {{code language="C#"}}
148 public GetCustomersCall.Response GetCustomers(string WebserviceUsername, string WebservicePassword, string CustomerUsername)
149         {
150             GetCustomersCall.Response set = new GetCustomersCall.Response();
151
152             try
153             {
154                 var content = new FormUrlEncodedContent(new[]
155                 {
156                     new KeyValuePair<string, string>("userName", WebserviceUsername),
157                     new KeyValuePair<string, string>("password", WebservicePassword),
158                     new KeyValuePair<string, string>("customerUsername", CustomerUsername),
159                 });
160
161                 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result;
162                 response.EnsureSuccessStatusCode();
163                 string responseMessage = response.Content.ReadAsStringAsync().Result;
164
165                 if (string.IsNullOrEmpty(responseMessage))
166                 {
167                     throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / GetCustomers" + "]");
168                 }
169                 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage)))
170                 {
171                     XmlSerializer serializer = new XmlSerializer(typeof(GetCustomersCall.Response));
172                     set = (GetCustomersCall.Response)serializer.Deserialize(ms);                 
173                 }
174             }
175             catch (Exception ex)
176             {
177                 #region handle exception
178                 set.Status = new BusinessEntities.LabRestService.GetCustomersCall.ResponseStatus();
179                 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();               
180                 set.Status.ErrorMessage = "Exception occurred in GetCustomers (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
181                 ex.Data.Add("WebserviceUsername", WebserviceUsername);
182                 ex.Data.Add("WebservicePassword", WebservicePassword);
183                 ex.Data.Add("CustomerUsername", CustomerUsername);
184                 ExceptionHandler.HandleException(ex);
185                 #endregion
186             }
187             return set;
188         }
189 {{/code}}
190
191 (% element-id="1566" %)
192
193 )))
194
195 (% element-id="1564" %)
196 (% element-id="1562" %)|(% element-id="1561" %)(% element-id="1560" %)
197 (((
198 (% element-id="1559" %)
199 POST https:~/~/<URL>/GetCustomers HTTP/1.1
200
201 (% element-id="1558" %)
202 Content-Type: application/x-www-form-urlencoded
203
204 (% element-id="1557" %)
205 Host: 81.175.89.24
206
207 (% element-id="1556" %)
208 Content-Length: 115
209
210 (% element-id="1555" %)
211 Expect: 100-continue
212
213
214 (% element-id="1552" %)
215 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>
216 )))
217
218 (% element-id="1551" %)
219 === (% element-id="1550" %)Response example(%%) ===
220
221 (% element-id="1549" %)
222 (% element-id="1547" %)|(% element-id="1546" %)(% element-id="1545" %)
223 (((
224 {{code language="XML"}}
225 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
226 <Response><Customers>
227   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="300" CustomerName="Adviesbureau De bodemkoning - Rotterdam" LastModifiedOnClient="2019-05-08T11:05:14.17+02:00" ></Customer>
228   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="656" CustomerName="Adviesbureau De bodemkoning - Delft" LastModifiedOnClient="2019-04-19T13:20:10.123+02:00" ></Customer>
229 </Customers>
230 <Status>
231     <StatusCode>1</StatusCode>
232     <StatusCodeDescription>OK</StatusCodeDescription>
233     <ErrorMessage></ErrorMessage>
234 </Status>
235 </Response>
236 {{/code}}
237
238 (% element-id="1492" %)
239
240 )))
241
242 (% element-id="1490" %)
243 == (% element-id="1489" %)Get Products (POST)(%%) ==
244
245 (% element-id="1488" %)
246 === (% element-id="1487" %)Request example(%%) ===
247
248 (% element-id="1486" %)
249 (% element-id="1484" %)|(% element-id="1483" %)(% element-id="1482" %)
250 (((
251 (% element-id="1481" %)
252 public GetProductsCall.Response GetProductList(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, int labid, string sikbVersion, string languageCode)
253
254 (% element-id="1480" %)
255 {
256
257
258 (% element-id="1477" %)
259 GetProductsCall.Response set = new GetProductsCall.Response();
260
261
262 (% element-id="1474" %)
263 try
264
265 (% element-id="1473" %)
266 {
267
268 (% element-id="1472" %)
269 bool useZipstream = true;
270
271 (% element-id="1471" %)
272 var content = new FormUrlEncodedContent(new[]
273
274 (% element-id="1470" %)
275 {
276
277 (% element-id="1469" %)
278 new KeyValuePair<string, string>("userName", WebserviceUsername),
279
280 (% element-id="1468" %)
281 new KeyValuePair<string, string>("password", WebservicePassword),
282
283 (% element-id="1467" %)
284 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
285
286 (% element-id="1466" %)
287 new KeyValuePair<string, string>("languageCode", languageCode),
288
289 (% element-id="1465" %)
290 new KeyValuePair<string, string>("clientId", customerid),
291
292 (% element-id="1464" %)
293 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
294
295 (% element-id="1463" %)
296 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
297
298 (% element-id="1462" %)
299 });
300
301
302 (% element-id="1459" %)
303 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetProducts", content).Result;
304
305 (% element-id="1458" %)
306 response.EnsureSuccessStatusCode();
307
308 (% element-id="1457" %)
309 string responseMessage = response.Content.ReadAsStringAsync().Result;
310
311
312 (% element-id="1454" %)
313 if (string.IsNullOrEmpty(responseMessage))
314
315 (% element-id="1453" %)
316 {
317
318 (% element-id="1452" %)
319 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetProducts" + "]");
320
321 (% element-id="1451" %)
322 }
323
324 (% element-id="1450" %)
325 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
326
327 (% element-id="1449" %)
328 {
329
330 (% element-id="1448" %)
331 XmlSerializer serializer = new XmlSerializer(typeof(GetProductsCall.Response));
332
333 (% element-id="1447" %)
334 set = (GetProductsCall.Response)serializer.Deserialize(ms);
335
336 (% element-id="1446" %)
337 }
338
339
340 (% element-id="1443" %)
341 if (useZipstream && !string.IsNullOrEmpty(set.FileContent))
342
343 (% element-id="1442" %)
344 {
345
346 (% element-id="1441" %)
347 ~/~/convert from base64 string back to normal
348
349 (% element-id="1440" %)
350 ~/~/first check for real Base64, by checking there is no 'xml'  in it
351
352 (% element-id="1439" %)
353 if (!set.FileContent.Contains("<labaanlevering"))
354
355 (% element-id="1438" %)
356 {
357
358 (% element-id="1437" %)
359 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);
360
361 (% element-id="1436" %)
362 }
363
364 (% element-id="1435" %)
365 }
366
367
368 (% element-id="1432" %)
369 }
370
371 (% element-id="1431" %)
372 catch (Exception ex)
373
374 (% element-id="1430" %)
375 {
376
377 (% element-id="1429" %)
378 #region handle exception
379
380
381 (% element-id="1426" %)
382 set.Status = new BusinessEntities.LabRestService.GetProductsCall.ResponseStatus();
383
384 (% element-id="1425" %)
385 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
386
387 (% element-id="1424" %)
388 set.Status.ErrorMessage = "Exception occurred in GetProducts (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
389
390
391 (% element-id="1421" %)
392 ex.Data.Add("WebserviceUsername", WebserviceUsername);
393
394 (% element-id="1420" %)
395 ex.Data.Add("WebservicePassword", WebservicePassword);
396
397 (% element-id="1419" %)
398 ex.Data.Add("CustomerUsername", CustomerUsername);
399
400 (% element-id="1418" %)
401 ex.Data.Add("sikbVersion", sikbVersion);
402
403 (% element-id="1417" %)
404 ex.Data.Add("customerid", customerid);
405
406 (% element-id="1416" %)
407 ex.Data.Add("languageCode", languageCode);
408
409
410 (% element-id="1413" %)
411 ExceptionHandler.HandleException(ex);
412
413 (% element-id="1412" %)
414 #endregion
415
416 (% element-id="1411" %)
417 }
418
419
420 (% element-id="1408" %)
421 return set;
422
423 (% element-id="1407" %)
424 }
425 )))
426
427 (% element-id="1406" %)
428 (% element-id="1404" %)|(% element-id="1403" %)(% element-id="1402" %)
429 (((
430 (% element-id="1401" %)
431 POST https:~/~/<URL>/GetProducts HTTP/1.1
432
433 (% element-id="1400" %)
434 Content-Type: application/x-www-form-urlencoded
435
436 (% element-id="1399" %)
437 Host: 81.175.89.24
438
439 (% element-id="1398" %)
440 Content-Length: 179
441
442 (% element-id="1397" %)
443 Expect: 100-continue
444
445
446 (% element-id="1394" %)
447 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>&languageCode=nld&clientId=300&sikbVersion=13.5.0&useZip=True
448 )))
449
450 (% element-id="1393" %)
451 === (% element-id="1392" %)Response example(%%) ===
452
453 (% element-id="1391" %)
454 (% element-id="1389" %)|(% element-id="1388" %)(% element-id="1387" %)
455 (((
456 (% element-id="1386" %)
457 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
458
459 (% element-id="1385" %)
460 <Response>
461
462 (% element-id="1384" %)
463 <FileContent> {SIKB FILE in ZIPSTREAM BASE64 format}</FileContent>
464
465 (% element-id="1383" %)
466 <Status>
467
468 (% element-id="1382" %)
469 <StatusCode>1</StatusCode>
470
471 (% element-id="1381" %)
472 <StatusCodeDescription>OK</StatusCodeDescription>
473
474 (% element-id="1380" %)
475 <ErrorMessage></ErrorMessage>
476
477 (% element-id="1379" %)
478 </Status></Response>
479 )))
480
481 (% element-id="1378" %)
482 = (% element-id="1377" %)Useraccount Checkup.(%%) =
483
484 (% element-id="1374" %)
485 == (% element-id="1373" %)Solution/Design(%%) ==
486
487 (% element-id="1372" %)
488 With every call we will no longer send customer usernames and customer passwords. We want to use a fixed Machine 2 Machine username and password for TerraIndex. So we need to be able to quickly check whether the Customer username we want to use exists, and is bound to our TerraIndex fixed Machine 2 machine account.
489
490 (% element-id="1371" %)
491 WebserviceUsername (string),
492 WebservicePassword (string),
493 CustomerUsername (string)
494
495
496 (% element-id="1366" %)
497 Therefore we call a Webserice for ValidCredentials Check:
498
499
500 (% class="table-hover" element-id="1363" %)
501 (% element-id="1361" %)|(% element-id="1360" %)(% element-id="1359" %)**Action**|(% element-id="1358" %)(% element-id="1357" %)**TerraIndex**|(% element-id="1356" %) |(% element-id="1354" %)(% element-id="1353" %)**Laboratorium**|(% element-id="1352" %)(% element-id="1351" %)**Parameters/Message**|(% element-id="1350" %)(% element-id="1349" %)**Remarks**|(% element-id="1348" %)(% element-id="1347" %)**ResultCodes**
502 (% element-id="1346" %)|(% element-id="1345" %)1|(% element-id="1344" %)Sends a request to the function: ValidCredentials().|=(% element-id="1343" %)>|(% element-id="1342" %) |(% element-id="1340" %)WebserviceUsername (string),
503 WebservicePassword (string),
504 CustomerUsername (string)|(% element-id="1337" %)We want to skip the Password of the customer, and we use the WebserviceUsername + WebservicePassword for real authentication.|(% element-id="1336" %)
505 (% element-id="1334" %)|(% element-id="1333" %)2|(% element-id="1332" %) |(% element-id="1330" %) |(% element-id="1328" %)Receives the request and checks the combination of WebserviceUsername and WebservicePassword is Ok. Then checks the CustomerUsername is valid.|(% element-id="1327" %) |(% element-id="1325" %) |(% element-id="1323" %)
506 (% element-id="1321" %)|(% element-id="1320" %)3|(% element-id="1319" %) |(% element-id="1317" %)<=|(% element-id="1316" %)Sends back a Success of InvalidCredentials|(% element-id="1315" %)ResultCode (),
507 ErrorMessage (string),|(% element-id="1313" %) |(% element-id="1311" %)1 = Success,
508 2 = GeneralError,
509 3 = WrongSIKBVersion,
510 4 = InvalidCredentials,
511 5 = CustomerUsernameInvalid,
512 6 = CustomerUsernameNotValidForCustomerCode
513 7 = FileContentProblem,
514 8 = InvalidOrderId,
515 9 = OrderIdAlreadyApproved
516 10 = PDFNotAvailable
517
518 (% element-id="1301" %)
519 == (% element-id="1300" %)Check ValidCredentials (POST)(%%) ==
520
521 (% element-id="1299" %)
522 === (% element-id="1298" %)Request example(%%) ===
523
524 (% element-id="1297" %)
525 (% element-id="1295" %)|(% element-id="1294" %)(% element-id="1293" %)
526 (((
527 (% element-id="1292" %)
528 public ValidCredentialsCall.Response ValidCredentials(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid)
529
530 (% element-id="1291" %)
531 {
532
533 (% element-id="1290" %)
534 ValidCredentialsCall.Response set = new ValidCredentialsCall.Response();
535
536
537 (% element-id="1287" %)
538 try
539
540 (% element-id="1286" %)
541 {
542
543
544 (% element-id="1283" %)
545 var content = new FormUrlEncodedContent(new[]
546
547 (% element-id="1282" %)
548 {
549
550 (% element-id="1281" %)
551 new KeyValuePair<string, string>("userName", WebserviceUsername),
552
553 (% element-id="1280" %)
554 new KeyValuePair<string, string>("password", WebservicePassword),
555
556 (% element-id="1279" %)
557 ~/~/new KeyValuePair<string, string>("clientId", customerid),   ~/~/ Optional
558
559 (% element-id="1278" %)
560 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
561
562 (% element-id="1277" %)
563 });
564
565
566 (% element-id="1274" %)
567 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/ValidCredentials", content).Result;
568
569 (% element-id="1273" %)
570 response.EnsureSuccessStatusCode();
571
572 (% element-id="1272" %)
573 string responseMessage = response.Content.ReadAsStringAsync().Result;
574
575
576 (% element-id="1269" %)
577 if (string.IsNullOrEmpty(responseMessage))
578
579 (% element-id="1268" %)
580 {
581
582 (% element-id="1267" %)
583 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / ValidCredentials" + "]");
584
585 (% element-id="1266" %)
586 }
587
588 (% element-id="1265" %)
589 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
590
591 (% element-id="1264" %)
592 {
593
594 (% element-id="1263" %)
595 XmlSerializer serializer = new XmlSerializer(typeof(ValidCredentialsCall.Response));
596
597 (% element-id="1262" %)
598 set = (ValidCredentialsCall.Response)serializer.Deserialize(ms);
599
600
601 (% element-id="1259" %)
602 return set;
603
604 (% element-id="1258" %)
605 }
606
607
608 (% element-id="1255" %)
609 }
610
611 (% element-id="1254" %)
612 catch (Exception ex)
613
614 (% element-id="1253" %)
615 {
616
617 (% element-id="1252" %)
618 #region handle exception
619
620
621 (% element-id="1249" %)
622 set.Status = new BusinessEntities.LabRestService.ValidCredentialsCall.ResponseStatus();
623
624 (% element-id="1248" %)
625 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
626
627 (% element-id="1247" %)
628 set.Status.ErrorMessage = "Exception occurred in GetValidCredentials (username: " + WebserviceUsername + ", with message: " + ex.Message;
629
630
631 (% element-id="1244" %)
632 ex.Data.Add("WebserviceUsername", WebserviceUsername);
633
634 (% element-id="1243" %)
635 ex.Data.Add("WebservicePassword", WebservicePassword);
636
637 (% element-id="1242" %)
638 ex.Data.Add("CustomerUsername", CustomerUsername);
639
640
641 (% element-id="1239" %)
642 ExceptionHandler.HandleException(ex);
643
644 (% element-id="1238" %)
645 #endregion
646
647 (% element-id="1237" %)
648 }
649
650
651 (% element-id="1234" %)
652 return set;
653
654 (% element-id="1233" %)
655 }
656 )))
657
658 (% element-id="1232" %)
659 (% element-id="1230" %)|(% element-id="1229" %)(% element-id="1228" %)
660 (((
661 (% element-id="1227" %)
662 POST https:~/~/<URL>/ValidCredentials HTTP/1.1
663
664 (% element-id="1226" %)
665 Content-Type: application/x-www-form-urlencoded
666
667 (% element-id="1225" %)
668 Host: 81.175.89.24
669
670 (% element-id="1224" %)
671 Content-Length: 125
672
673 (% element-id="1223" %)
674 Expect: 100-continue
675
676
677 (% element-id="1220" %)
678 userName=<webservice_username>&password=<Webservice_password>&clientId=<optional otherwise empty>&customerUsername=<customer_username or token>
679 )))
680
681 (% element-id="1219" %)
682 === (% element-id="1218" %)Response example(%%) ===
683
684 (% element-id="1217" %)
685 (% element-id="1215" %)|(% element-id="1214" %)(% element-id="1213" %)
686 (((
687 (% element-id="1212" %)
688 <?xml version="1.0" encoding="UTF-8" standalone="no"?><Response>
689
690 (% element-id="1211" %)
691 <Status>
692
693 (% element-id="1210" %)
694 <StatusCode>1</StatusCode>
695
696 (% element-id="1209" %)
697 <StatusCodeDescription>OK</StatusCodeDescription>
698
699 (% element-id="1208" %)
700 <ErrorMessage></ErrorMessage>
701
702 (% element-id="1207" %)
703 </Status>
704
705 (% element-id="1206" %)
706 </Response>
707 )))
708
709 (% element-id="1205" %)
710 = (% element-id="1204" %)Labassignment request delivery(POST)(%%) =
711
712 (% element-id="1203" %)
713 == (% element-id="1202" %)Solution/Design(%%) ==
714
715 (% element-id="1201" %)
716 For this we create a Webservice for CreateOrder to create the order in the lab system.
717 After the creation, we would like to show an order overview of the laboratory in the future in PDF. The user can see the prices and can confirm or cancel.
718 Depending on the user's choice at the laboratory, to support this or not, TerraIndex calls the ApproveOrder or the CancelOrder.
719
720 (% element-id="0" %)
721 For default we assume that we cannot do this yet, and TerraIndex sends needsApprovaIsSupported = false. If this becomes true in the future, the Lab can indicate whether or not it is necessary in the NeedsApprove field.
722
723
724 (% class="table-hover" element-id="1195" %)
725 (% element-id="1193" %)|(% element-id="1192" %)(% element-id="1191" %)**Action**|(% element-id="1190" %)(% element-id="1189" %)**TerraIndex**|(% element-id="1188" %) |(% element-id="1186" %)(% element-id="1185" %)**Laboratorium**|(% element-id="1184" %)(% element-id="1183" %)**Parameters/Message**|(% element-id="1182" %)(% element-id="1181" %)**Remarks**|(% element-id="1180" %)(% element-id="1179" %)**ResultCodes**
726 (% element-id="1178" %)|(% element-id="1177" %)1|(% element-id="1176" %)Sends a request to the function: CreateOrder().|=(% element-id="1175" %)>|(% element-id="1174" %) |(% element-id="1172" %)WebserviceUsername (string),
727 WebservicePassword (string),
728 CustomerUsername (string),
729 FileContent_Base64 (string),
730 UseZipStream/UseZip (bool, default: 'false'),
731 CustomerCode (string),
732 SIKBVersion (string, default: '13.4.0'),
733 needsApprovalIsSupported (bool)|(% element-id="1164" %)SIKB Version included, so labs can quickly check the version.
734 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0.
735 \\Before sending the SIKB, validate to the XSD!
736 And to the XSLT?
737 \\needsApprovalIsSupported = false; means we dont get PDF with offerte. This will make is faster.
738 needsApprovalIsSupported = true; means lab will check the user setting to send a PDF Offerte back or not. (If the lab can support this.)|(% element-id="1156" %)
739 (% element-id="1154" %)|(% element-id="1153" %)2|(% element-id="1152" %) |(% element-id="1150" %) |(% element-id="1148" %)Receives the request and checks the credentials.|(% element-id="1147" %) |(% element-id="1145" %) |(% element-id="1143" %)
740 (% element-id="1141" %)|(% colspan="1" element-id="1140" %)3|(% colspan="1" element-id="1139" %) |(% colspan="1" element-id="1137" %) |(% colspan="1" element-id="1135" %)Credentials are valid, the Filecontent is checked on a valid Labassignment. When valid it will be processed and a OrderId is given.|(% colspan="1" element-id="1134" %) |(% colspan="1" element-id="1132" %)Laboratorium saves the Sample GUIDs if it's SIKB 13 or higher.
741 Otherwise we use the idanlmons unique ID.|(% colspan="1" element-id="1130" %)
742 (% element-id="1128" %)|(% colspan="1" element-id="1127" %) |(% colspan="1" element-id="1125" %) |(% colspan="1" element-id="1123" %) |(% colspan="1" element-id="1121" %)Based on what customer, the order will be approved or the approve needs to be done in laboratorium system.|(% colspan="1" element-id="1120" %) |(% colspan="1" element-id="1118" %) |(% colspan="1" element-id="1116" %)
743 (% element-id="1114" %)|(% element-id="1113" %)4|(% element-id="1112" %) |(% element-id="1110" %)<=|(% element-id="1109" %)Sends back a Success with the new OrderId|(% element-id="1108" %)ResultCode (),
744 ErrorMessage (string),
745 OrderId (string),
746 NeedsApprove (bool),
747 FileContent_Base64 (string),
748 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="1102" %)In the future labs will send back the PDF with the prices and some checks. To approve or cancel. For the first version this is not required yet and the fileContent remains empty.|(% element-id="1101" %)1 = Success,
749 2 = GeneralError,
750 3 = WrongSIKBVersion,
751 4 = InvalidCredentials,
752 5 = CustomerUsernameInvalid,
753 6 = CustomerUsernameNotValidForCustomerCode
754 7 = FileContentProblem,
755 8 = InvalidOrderId,
756 9 = OrderIdAlreadyApproved
757 10 = PDFNotAvailable
758 (% element-id="1091" %)|(% colspan="1" element-id="1090" %)6|(% colspan="1" element-id="1089" %)Receives the OrderId, and saves it.
759 |(% colspan="1" element-id="1086" %) |(% colspan="1" element-id="1084" %) |(% colspan="1" element-id="1082" %) |(% colspan="1" element-id="1080" %)(% element-id="1079" %)
760 (((
761 (% element-id="1078" %)
762 Default for now laboratorium will send:
763 NeedsApprove = False,
764 PDF = Empty,
765 Zipstream = False,
766
767
768 (% element-id="1072" %)
769 In the future, do something with the PDF and show the PDF to users to Approve or Cancel.
770 This will be done by; NeedsApprove = true.
771 \\If NeedsApprove is False, the order is Processed and can't be changed in TI. Like it is now.
772
773 (% element-id="1068" %)
774
775 )))|(% colspan="1" element-id="1066" %)
776 (% element-id="1064" %)|(% colspan="1" element-id="1063" %) |(% colspan="1" element-id="1061" %) |(% colspan="1" element-id="1059" %) |(% colspan="1" element-id="1057" %) |(% colspan="1" element-id="1055" %) |(% colspan="1" element-id="1053" %) |(% colspan="1" element-id="1051" %)
777 (% element-id="1049" %)|(% colspan="1" element-id="1048" %) |(% colspan="1" element-id="1046" %) |(% colspan="1" element-id="1044" %) |(% colspan="1" element-id="1042" %) |(% colspan="1" element-id="1040" %) |(% colspan="1" element-id="1038" %) |(% colspan="1" element-id="1036" %)
778 (% element-id="1034" %)|(% colspan="1" element-id="1033" %) |(% colspan="1" element-id="1031" %)(% element-id="1030" %)**IN THE FUTURE: APPROVEORDER**|(% colspan="1" element-id="1029" %) |(% colspan="1" element-id="1027" %) |(% colspan="1" element-id="1025" %) |(% colspan="1" element-id="1023" %) |(% colspan="1" element-id="1021" %)
779 (% element-id="1019" %)|(% colspan="1" element-id="1018" %)7|(% colspan="1" element-id="1017" %)Sends a request to the function: ApproveOrder().|(% colspan="1" element-id="1016" %)=>|(% colspan="1" element-id="1015" %) |(% colspan="1" element-id="1013" %)WebserviceUsername (string),
780 WebservicePassword (string),
781 CustomerUsername (string),
782 OrderId (string)|(% colspan="1" element-id="1009" %) |(% colspan="1" element-id="1007" %)
783 (% element-id="1005" %)|(% colspan="1" element-id="1004" %)8|(% colspan="1" element-id="1003" %) |(% colspan="1" element-id="1001" %) |(% colspan="1" element-id="999" %)Receives the approve and checks the credentials and the OrderId.|(% colspan="1" element-id="998" %) |(% colspan="1" element-id="996" %) |(% colspan="1" element-id="994" %)
784 (% element-id="992" %)|(% colspan="1" element-id="991" %)9|(% colspan="1" element-id="990" %) |(% colspan="1" element-id="988" %)<=|(% colspan="1" element-id="987" %)Sends back a Success with the new CertificateNr|(% colspan="1" element-id="986" %)ResultCode (),
785 ErrorMessage (string),
786 CertificateNr (string)|(% colspan="1" element-id="983" %)This process takes too long at some labs. Maybe this won't be workable...so maybe the CertificateNr return won't be possible. In this case, leave the CertificateNr empty. TerraIndex will read it from GetOrderStatus calls.|(% colspan="1" element-id="982" %)1 = Success,
787 2 = GeneralError,
788 3 = WrongSIKBVersion,
789 4 = InvalidCredentials,
790 5 = CustomerUsernameInvalid,
791 6 = CustomerUsernameNotValidForCustomerCode
792 7 = FileContentProblem,
793 8 = InvalidOrderId,
794 9 = OrderIdAlreadyApproved
795 10 = PDFNotAvailable
796 (% element-id="972" %)|(% colspan="1" element-id="971" %)10|(% colspan="1" element-id="970" %)Receives the CerificateNr and saves it.|(% colspan="1" element-id="969" %) |(% colspan="1" element-id="967" %) |(% colspan="1" element-id="965" %) |(% colspan="1" element-id="963" %) |(% colspan="1" element-id="961" %)
797 (% element-id="959" %)|(% colspan="1" element-id="958" %) |(% colspan="1" element-id="956" %) |(% colspan="1" element-id="954" %) |(% colspan="1" element-id="952" %) |(% colspan="1" element-id="950" %) |(% colspan="1" element-id="948" %) |(% colspan="1" element-id="946" %)
798 (% element-id="944" %)|(% colspan="1" element-id="943" %) |(% colspan="1" element-id="941" %)(% element-id="940" %)**IN THE FUTURE: CANCELORDER**|(% colspan="1" element-id="939" %) |(% colspan="1" element-id="937" %) |(% colspan="1" element-id="935" %) |(% colspan="1" element-id="933" %) |(% colspan="1" element-id="931" %)
799 (% element-id="929" %)|(% element-id="928" %)7|(% element-id="927" %)Sends a request to the function: CancelOrder().|=(% element-id="926" %)>|(% element-id="925" %) |(% element-id="923" %)WebserviceUsername (string),
800 WebservicePassword (string),
801 CustomerUsername (string),
802 OrderId (string)|(% element-id="919" %) |(% element-id="917" %)
803 (% element-id="915" %)|(% element-id="914" %)8|(% element-id="913" %) |(% element-id="911" %) |(% element-id="909" %)Receives the cancel and checks the credentials and the OrderId.|(% element-id="908" %) |(% element-id="906" %) |(% element-id="904" %)
804 (% element-id="902" %)|(% element-id="901" %)9|(% element-id="900" %) |(% element-id="898" %)<=|(% element-id="897" %)Sends back a Success |(% element-id="896" %)ResultCode (),
805 ErrorMessage (string)|(% element-id="894" %) |(% element-id="892" %)1 = Success,
806 2 = GeneralError,
807 3 = WrongSIKBVersion,
808 4 = InvalidCredentials,
809 5 = CustomerUsernameInvalid,
810 6 = CustomerUsernameNotValidForCustomerCode
811 7 = FileContentProblem,
812 8 = InvalidOrderId,
813 9 = OrderIdAlreadyApproved
814 10 = PDFNotAvailable
815 (% element-id="882" %)|(% element-id="881" %)10|(% element-id="880" %)Removes the OrderId and the IsSend to False|(% element-id="879" %) |(% element-id="877" %) |(% element-id="875" %) |(% element-id="873" %)If OrderIsAleadyApproved, set the values to Approved and keep the OrderId and IsSend.|(% element-id="872" %)
816 (% element-id="870" %)|(% colspan="1" element-id="869" %) |(% colspan="1" element-id="867" %) |(% colspan="1" element-id="865" %) |(% colspan="1" element-id="863" %) |(% colspan="1" element-id="861" %) |(% colspan="1" element-id="859" %) |(% colspan="1" element-id="857" %)
817
818 (% element-id="855" %)
819 == (% element-id="854" %)Create Order(%%) ==
820
821 (% element-id="853" %)
822 === (% element-id="852" %)Request example(%%) ===
823
824 (% element-id="851" %)
825 (% element-id="849" %)|(% element-id="848" %)(% element-id="847" %)
826 (((
827 (% element-id="846" %)
828 public CreateOrderResponse.Response SendLabAssignment(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, string sikbVersion, string assignmentXML, string languageCode, bool needsApprovalIsSupported = false)
829
830 (% element-id="845" %)
831 {
832
833 (% element-id="844" %)
834 CreateOrderResponse.Response set = new CreateOrderResponse.Response();
835
836
837 (% element-id="841" %)
838 try
839
840 (% element-id="840" %)
841 {
842
843 (% element-id="839" %)
844 bool useZipstream = true;
845
846
847 (% element-id="836" %)
848 MultipartFormDataContent content = new MultipartFormDataContent();
849
850
851 (% element-id="833" %)
852 ~/~/Add Formdata
853
854 (% element-id="832" %)
855 var formDataDictionary = new[]
856
857 (% element-id="831" %)
858 {
859
860 (% element-id="830" %)
861 new KeyValuePair<string, string>("userName", WebserviceUsername),
862
863 (% element-id="829" %)
864 new KeyValuePair<string, string>("password", WebservicePassword),
865
866 (% element-id="828" %)
867 new KeyValuePair<string, string>("customerUserName", CustomerUsername),
868
869 (% element-id="827" %)
870 new KeyValuePair<string, string>("clientId", customerid),
871
872 (% element-id="826" %)
873 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
874
875 (% element-id="825" %)
876 new KeyValuePair<string, string>("languageCode", languageCode),
877
878 (% element-id="824" %)
879 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
880
881 (% element-id="823" %)
882 new KeyValuePair<string, string>("needsApprovalIsSupported", needsApprovalIsSupported.ToString() ),
883
884 (% element-id="822" %)
885 ~/~/new KeyValuePair<string, string>("orderXml", ZipStreamHelper.CompressToBase64String(assignmentXML)),
886
887 (% element-id="821" %)
888 ~/~/new KeyValuePair<string, string>("orderXml", assignmentXML),
889
890 (% element-id="820" %)
891 };              
892
893 (% element-id="819" %)
894 foreach (var item in formDataDictionary)
895
896 (% element-id="818" %)
897 {
898
899 (% element-id="817" %)
900 content.Add(new StringContent(item.Value), $"\"{item.Key}\"");
901
902 (% element-id="816" %)
903 }
904
905
906 (% element-id="813" %)
907 string filexml = string.Empty;
908
909 (% element-id="812" %)
910 if (useZipstream)
911
912 (% element-id="811" %)
913 {
914
915 (% element-id="810" %)
916 filexml = ZipStreamHelper.CompressToBase64String(assignmentXML);
917
918 (% element-id="809" %)
919 }
920
921 (% element-id="808" %)
922 else
923
924 (% element-id="807" %)
925 {
926
927 (% element-id="806" %)
928 filexml = assignmentXML;
929
930 (% element-id="805" %)
931 }
932
933
934 (% element-id="802" %)
935 ~/~/Add filecontent
936
937 (% element-id="801" %)
938 var fileContent = new ByteArrayContent(ZipStreamHelper.stringToByteArray(filexml));
939
940 (% element-id="800" %)
941 fileContent.Headers.ContentDisposition =
942
943 (% element-id="799" %)
944 new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") ~/~/<- 'form-data' instead of 'attachment'
945
946 (% element-id="798" %)
947 {
948
949 (% element-id="797" %)
950 Name = "\"orderXml\"", ~/~/ \" is needed so the message contains the quotes, wihtout it will fail
951
952 (% element-id="796" %)
953 FileName = "\"VivaTerraIndexAssignment.xml\""
954
955 (% element-id="795" %)
956 };
957
958 (% element-id="794" %)
959 fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/xml");              
960
961 (% element-id="793" %)
962 content.Add(fileContent);
963
964
965 (% element-id="790" %)
966 ~/~/Start sending
967
968
969 (% element-id="787" %)
970 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/CreateOrder", content).Result;
971
972 (% element-id="786" %)
973 response.EnsureSuccessStatusCode();
974
975 (% element-id="785" %)
976 string responseMessage = response.Content.ReadAsStringAsync().Result;
977
978
979 (% element-id="782" %)
980 if (string.IsNullOrEmpty(responseMessage))
981
982 (% element-id="781" %)
983 {
984
985 (% element-id="780" %)
986 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /CreateOrder" + "]");
987
988 (% element-id="779" %)
989 }
990
991 (% element-id="778" %)
992 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
993
994 (% element-id="777" %)
995 {
996
997 (% element-id="776" %)
998 XmlSerializer serializer = new XmlSerializer(typeof(CreateOrderResponse.Response));
999
1000 (% element-id="775" %)
1001 set = (CreateOrderResponse.Response)serializer.Deserialize(ms);
1002
1003 (% element-id="774" %)
1004 }
1005
1006
1007 (% element-id="771" %)
1008 ~/~/Can contain a PDf with price information
1009
1010 (% element-id="770" %)
1011 if (set.UseZip && !string.IsNullOrEmpty(set.FileContent))
1012
1013 (% element-id="769" %)
1014 {
1015
1016 (% element-id="768" %)
1017 ~/~/convert from base64 string back to normal
1018
1019 (% element-id="767" %)
1020 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);                  
1021
1022 (% element-id="766" %)
1023 }
1024
1025
1026 (% element-id="763" %)
1027 }
1028
1029 (% element-id="762" %)
1030 catch (Exception ex)
1031
1032 (% element-id="761" %)
1033 {
1034
1035 (% element-id="760" %)
1036 #region handle exception
1037
1038
1039 (% element-id="757" %)
1040 set.Status = new BusinessEntities.LabRestService.CreateOrderResponse.ResponseStatus();
1041
1042 (% element-id="756" %)
1043 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1044
1045 (% element-id="755" %)
1046 set.Status.ErrorMessage = "Exception occurred in CreateOrder (username: " + WebserviceUsername + ") with message: " + ex.Message;
1047
1048
1049 (% element-id="752" %)
1050 ex.Data.Add("WebserviceUsername", WebserviceUsername);
1051
1052 (% element-id="751" %)
1053 ex.Data.Add("WebservicePassword", WebservicePassword);
1054
1055 (% element-id="750" %)
1056 ex.Data.Add("CustomerUsername", CustomerUsername);
1057
1058 (% element-id="749" %)
1059 ex.Data.Add("sikbVersion", sikbVersion);
1060
1061 (% element-id="748" %)
1062 ex.Data.Add("customerid", customerid);
1063
1064
1065 (% element-id="745" %)
1066 ExceptionHandler.HandleException(ex);
1067
1068 (% element-id="744" %)
1069 #endregion
1070
1071 (% element-id="743" %)
1072 }
1073
1074
1075 (% element-id="740" %)
1076 return set;
1077
1078 (% element-id="739" %)
1079 }
1080 )))
1081
1082 (% element-id="738" %)
1083 (% element-id="736" %)|(% element-id="735" %)(% element-id="734" %)
1084 (((
1085 (% element-id="733" %)
1086 POST https:~/~/<URL>/CreateOrder HTTP/1.1
1087
1088 (% element-id="732" %)
1089 Content-Type: multipart/form-data; boundary="28a3e130-70c9-4a1a-b544-a802a1ade6ca"
1090
1091 (% element-id="731" %)
1092 Host: 81.175.89.24
1093
1094 (% element-id="730" %)
1095 Content-Length: 5010
1096
1097 (% element-id="729" %)
1098 Expect: 100-continue
1099
1100
1101 (% element-id="726" %)
1102 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1103
1104 (% element-id="725" %)
1105 Content-Type: text/plain; charset=utf-8
1106
1107 (% element-id="724" %)
1108 Content-Disposition: form-data; name="userName"
1109
1110
1111 (% element-id="721" %)
1112 <Webservice_Username>
1113
1114 (% element-id="720" %)
1115 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1116
1117 (% element-id="719" %)
1118 Content-Type: text/plain; charset=utf-8
1119
1120 (% element-id="718" %)
1121 Content-Disposition: form-data; name="password"
1122
1123
1124 (% element-id="715" %)
1125 <Webservice_Password>
1126
1127 (% element-id="714" %)
1128 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1129
1130 (% element-id="713" %)
1131 Content-Type: text/plain; charset=utf-8
1132
1133 (% element-id="712" %)
1134 Content-Disposition: form-data; name="customerUserName"
1135
1136
1137 (% element-id="709" %)
1138 <Customer_Username or token>
1139
1140 (% element-id="708" %)
1141 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1142
1143 (% element-id="707" %)
1144 Content-Type: text/plain; charset=utf-8
1145
1146 (% element-id="706" %)
1147 Content-Disposition: form-data; name="clientId"
1148
1149
1150 (% element-id="703" %)
1151 300
1152
1153 (% element-id="702" %)
1154 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1155
1156 (% element-id="701" %)
1157 Content-Type: text/plain; charset=utf-8
1158
1159 (% element-id="700" %)
1160 Content-Disposition: form-data; name="sikbVersion"
1161
1162
1163 (% element-id="697" %)
1164 13.4.0
1165
1166 (% element-id="696" %)
1167 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1168
1169 (% element-id="695" %)
1170 Content-Type: text/plain; charset=utf-8
1171
1172 (% element-id="694" %)
1173 Content-Disposition: form-data; name="languageCode"
1174
1175
1176 (% element-id="691" %)
1177 nld
1178
1179 (% element-id="690" %)
1180 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1181
1182 (% element-id="689" %)
1183 Content-Type: text/plain; charset=utf-8
1184
1185 (% element-id="688" %)
1186 Content-Disposition: form-data; name="useZip"
1187
1188
1189 (% element-id="685" %)
1190 True
1191
1192 (% element-id="684" %)
1193 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1194
1195 (% element-id="683" %)
1196 Content-Type: text/plain; charset=utf-8
1197
1198 (% element-id="682" %)
1199 Content-Disposition: form-data; name="needsApprovalIsSupported"
1200
1201
1202 (% element-id="679" %)
1203 False
1204
1205 (% element-id="678" %)
1206 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1207
1208 (% element-id="677" %)
1209 Content-Disposition: form-data; name="orderXml"; filename="VivaTerraIndexAssignment.xml"
1210
1211 (% element-id="676" %)
1212 Content-Type: application/xml
1213
1214
1215 (% element-id="673" %)
1216 <SIKB File in Zip stream Base64  encoding>
1217
1218 (% element-id="672" %)
1219 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca~-~-
1220 )))
1221
1222 (% element-id="671" %)
1223 === (% element-id="670" %)Response example(%%) ===
1224
1225 (% element-id="669" %)
1226 (% element-id="667" %)|(% element-id="666" %)(% element-id="665" %)
1227 (((
1228 (% element-id="664" %)
1229 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1230
1231 (% element-id="663" %)
1232 <Response>
1233
1234 (% element-id="662" %)
1235 <OrderId>7113828</OrderId>
1236
1237 (% element-id="661" %)
1238 <NeedsApproval>True</NeedsApproval>
1239
1240 (% element-id="660" %)
1241 <FileContent></FileContent>
1242
1243 (% element-id="659" %)
1244 <Status>
1245
1246 (% element-id="658" %)
1247 <StatusCode>1</StatusCode>
1248
1249 (% element-id="657" %)
1250 <StatusCodeDescription>OK</StatusCodeDescription>
1251
1252 (% element-id="656" %)
1253 <ErrorMessage></ErrorMessage>
1254
1255 (% element-id="655" %)
1256 </Status></Response>
1257 )))
1258
1259 (% element-id="654" %)
1260 = (% element-id="653" %)Get Order status and Results XML and with PDF(%%) =
1261
1262 (% element-id="652" %)
1263 == (% element-id="651" %)Solution/Design(%%) ==
1264
1265 (% element-id="650" %)
1266 TerraIndex will request per license/customer which results are ready. These are queried if the latest changes are newer than the last check. This way we never download too much unnecessarily and it can always be requested again.
1267
1268
1269 (% class="box infomessage" element-id="650" %)
1270 (((
1271 **Order status** we support as minimal:
1272 3 = Reportnumber is known, no results yet, but it's the official report certificate number. This is optional to send.
1273 4 = Conceptual, temporary results avaiable, but not final yet. This is optional to send.
1274 5 = Final results are available. This is required to send.
1275 )))
1276
1277 (% class="table-hover" element-id="647" %)
1278 (% element-id="645" %)|(% element-id="644" %)Action|(% element-id="643" %)TerraIndex|(% element-id="642" %) |(% element-id="640" %)Laboratorium|(% element-id="639" %)Parameters/Message|(% element-id="638" %)Remarks|(% element-id="637" %)ResultCodes
1279 (% element-id="636" %)|(% element-id="635" %)1|(% element-id="634" %)Sends a request to the function: GetCustomers().|=(% element-id="633" %)>|(% element-id="632" %) |(% element-id="630" %)WebserviceUsername (string), 
1280 WebservicePassword (string),
1281 CustomerUsername (string)|(% element-id="627" %)We want to skip the Password of the customer, and we introduce the WebserviceUsername + WebservicePassword.|(% element-id="626" %)
1282 (% element-id="624" %)|(% element-id="623" %)2|(% element-id="622" %) |(% element-id="620" %) |(% element-id="618" %)Receives the request and check the customers this username and searches the dateLastChanged for this Customer.|(% element-id="617" %) |(% element-id="615" %) |(% element-id="613" %)
1283 (% element-id="611" %)|(% element-id="610" %)3|(% element-id="609" %) |(% element-id="607" %)<=|(% element-id="606" %)Sends back the list of customers to check for orderStatuses|(% element-id="605" %)ResultCode (),
1284 ErrorMessage (string),
1285 List<customer> , Customer:
1286 CustomerCode (string),
1287 CustomerName (string),
1288 LabID (int),
1289 LabName (string),
1290 ChangedTimeStamp (DateTime)|(% element-id="597" %)We receive the dateTimestamp instead of sending it, so we always get the full list and we are also able to delete customercodes.|(% element-id="596" %)1 = Success,
1291 2 = GeneralError,
1292 3 = WrongSIKBVersion,
1293 4 = InvalidCredentials,
1294 5 = CustomerUsernameInvalid,
1295 6 = CustomerUsernameNotValidForCustomerCode
1296 7 = FileContentProblem,
1297 8 = InvalidOrderId,
1298 9 = OrderIdAlreadyApproved
1299 10 = PDFNotAvailable
1300 (% element-id="586" %)|(% element-id="585" %)4|(% element-id="584" %)Receives the list of Customers. Read the Timestamp this Customer is last checked for Results/Statuses.|(% element-id="583" %) |(% element-id="581" %) |(% element-id="579" %) |(% element-id="577" %) |(% element-id="575" %)
1301 (% element-id="573" %)|(% element-id="572" %)5|(% element-id="571" %)Send for each Customer a  call to retreive all orders statuses changes since a certain timestamp.
1302 Function: GetOrderStatuses()|=(% element-id="569" %)>|(% element-id="568" %) |(% element-id="566" %)WebserviceUsername (string), 
1303 WebservicePassword (string),
1304 CustomerUsername (string),
1305 CustomerCode (string),
1306 LastCheckedTimestamp (DateTime)|(% element-id="561" %)TerraIndex keeps track of the last check timestamp for each license.|(% element-id="560" %)
1307 (% element-id="558" %)|(% element-id="557" %)6|(% element-id="556" %) |(% element-id="554" %) |(% element-id="552" %)Receives the request and check the orders that are changed since the timestamp for this Customer.|(% element-id="551" %) |(% element-id="549" %) |(% element-id="547" %)
1308 (% element-id="545" %)|(% element-id="544" %)7|(% element-id="543" %) |(% element-id="541" %)<=|(% element-id="540" %)Sends back the list of orders with the status and lastChangedTimestamp|(% element-id="539" %)ResultCode (),
1309 ErrorMessage (string),
1310 OrderID (string),
1311 LabassignmentGUID (GUID),
1312 CertificateNumber (string)
1313 OrderStatusSIKB (int),
1314 Delayed (boolean),
1315 ExpectedTimeStamp (DateTime),|(% element-id="531" %)OrderStatusSIKB is the SIKB Labassignment status.
1316 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1317 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1318 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="525" %)1 = Success,
1319 2 = GeneralError,
1320 3 = WrongSIKBVersion,
1321 4 = InvalidCredentials,
1322 5 = CustomerUsernameInvalid,
1323 6 = CustomerUsernameNotValidForCustomerCode
1324 7 = FileContentProblem,
1325 8 = InvalidOrderId,
1326 9 = OrderIdAlreadyApproved
1327 10 = PDFNotAvailable
1328 (% element-id="515" %)|(% element-id="514" %)8|(% element-id="513" %)Receives the list of Orders with status.
1329 Update the CertificateNr if this is not already present in the labassignment. |(% element-id="511" %) |(% element-id="509" %) |(% element-id="507" %) |(% element-id="505" %)CertifcateNumber could be new here, if the lab wasn't able to fill it directly at the ApproveOrder.|(% element-id="504" %)
1330 (% element-id="502" %)|(% element-id="501" %)9|(% element-id="500" %)Send for each Order a call to retreive all results.
1331 Function: GetOrderResults()|=(% element-id="498" %)>|(% element-id="497" %) |(% element-id="495" %)WebserviceUsername (string), 
1332 WebservicePassword (string),
1333 CustomerUsername (string),
1334 CustomerCode (string),
1335 OrderID (string),
1336 SIKBVersion (string, default: '13.4.0')|(% element-id="489" %)Besides SIKB 13.4.0, TerraIndex also supports 9.0.0/8.0.0 etc.|(% element-id="488" %)
1337 (% element-id="486" %)|(% element-id="485" %)10|(% element-id="484" %) |(% element-id="482" %) |(% element-id="480" %)Receives the request and creates a SIKB results file based on the version that is requested.|(% element-id="479" %) |(% element-id="477" %) |(% element-id="475" %)
1338 (% element-id="473" %)|(% element-id="472" %)11|(% element-id="471" %) |(% element-id="469" %)<=|(% element-id="468" %)Sends back the results of the orders.|(% element-id="467" %)ResultCode (),
1339 ErrorMessage (string),
1340 OrderId (string),
1341 LabassignmentGUID (GUID),
1342 FileContent_Base64 (string),
1343 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="461" %) |(% element-id="459" %)1 = Success,
1344 2 = GeneralError,
1345 3 = WrongSIKBVersion,
1346 4 = InvalidCredentials,
1347 5 = CustomerUsernameInvalid,
1348 6 = CustomerUsernameNotValidForCustomerCode
1349 7 = FileContentProblem,
1350 8 = InvalidOrderId,
1351 9 = OrderIdAlreadyApproved
1352 10 = PDFNotAvailable
1353 (% element-id="449" %)|(% element-id="448" %)12|(% element-id="447" %)Receives the results and imports all results.|(% element-id="446" %) |(% element-id="444" %) |(% element-id="442" %) |(% element-id="440" %)(% element-id="439" %)
1354 (((
1355 (% element-id="438" %)
1356 Import will be done to corresponding samples based on:
1357
1358 (% element-id="437" %)
1359 * Find Project by ProjectGUID (as provided in the labassignment)
1360 * Find Project by ProjectCode (as provided in the Labassignment)
1361 * Find Project and Labassignment by LabassignmentGUID (as provided in the Labassignment)
1362 * Find Project (only if Project is not found yet) and Samples based on SampleGUID (as provided in the Labassignment) .
1363 Sample GUIDs that are send to the lab in the labassignment version SIKB 13 or higher are required in the results for labassignment.
1364 For lower version Labassignments the lab should return the 'old' idanlmons as SampleGUID in the XML.
1365 * Find Samples (only if Project is already found ) by SampleName
1366
1367 (% element-id="429" %)
1368 What is imported?
1369
1370 (% element-id="428" %)
1371 * If Sample is found, the results in the XML are always all updated and/or inserted.
1372 * If Project is found, but the sample is not; The Sample and the results are inserted as new Sample. (If watersample; fake filtertube and fake measurementpoints are created)
1373 )))|(% element-id="425" %)
1374 (% element-id="423" %)|(% element-id="422" %)13|(% element-id="421" %)If OrderStatus is 'Completed/Reported' (SIKBID: 5)
1375 Request the PDF certificate.
1376 Function: GetOrderPDF()|=(% element-id="418" %)>|(% element-id="417" %) |(% element-id="415" %)WebserviceUsername (string), 
1377 WebservicePassword (string),
1378 CustomerUsername (string),
1379 CustomerCode (string),
1380 OrderID (string),|(% element-id="410" %) |(% element-id="408" %)
1381 (% element-id="406" %)|(% element-id="405" %)14|(% element-id="404" %) |(% element-id="402" %) |(% element-id="400" %)Receives the request and creates the PDF for the Order.|(% element-id="399" %) |(% element-id="397" %) |(% element-id="395" %)
1382 (% element-id="393" %)|(% element-id="392" %)15|(% element-id="391" %) |(% element-id="389" %)<=|(% element-id="388" %)Sends back the PDF of the order.|(% element-id="387" %)ResultCode (),
1383 ErrorMessage (string),
1384 OrderId (string),
1385 LabassignmentGUID (GUID),
1386 FileContent_Base64 (string),
1387 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="381" %)If the PDF is not available yet, please give the resultcode: PDFNotAvailable.|(% element-id="380" %)1 = Success,
1388 2 = GeneralError,
1389 3 = WrongSIKBVersion,
1390 4 = InvalidCredentials,
1391 5 = CustomerUsernameInvalid,
1392 6 = CustomerUsernameNotValidForCustomerCode
1393 7 = FileContentProblem,
1394 8 = InvalidOrderId,
1395 9 = OrderIdAlreadyApproved
1396 10 = PDFNotAvailable
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
1399 (% element-id="357" %)
1400 == Request example Order Status ==
1401
1402 public GetOrderStatusesCall.Response OrderStatuses(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, DateTime? timestampSince)
1403 {
1404 GetOrderStatusesCall.Response set = new GetOrderStatusesCall.Response();
1405 string responseMessage = null;
1406
1407 if (timestampSince == null) timestampSince = DateTime.Now.AddHours(-3); ~/~/Now, minus 3 hours
1408 var formattedTimestamp = System.Xml.XmlConvert.ToString((DateTime)timestampSince, System.Xml.XmlDateTimeSerializationMode.RoundtripKind);
1409
1410 try
1411 {
1412 var content = new FormUrlEncodedContent(new[]
1413 {
1414 new KeyValuePair<string, string>("userName", WebserviceUsername),
1415 new KeyValuePair<string, string>("password", WebservicePassword),
1416 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
1417 new KeyValuePair<string, string>("clientId", customerid),
1418 new KeyValuePair<string, string>("lastModified", formattedTimestamp),
1419 });
1420
1421 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetOrderStatuses", content).GetAwaiter().GetResult();
1422 responseMessage = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
1423 response.EnsureSuccessStatusCode();
1424
1425 if (string.IsNullOrEmpty(responseMessage))
1426 {
1427 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetOrderStatuses" + "]");
1428 }
1429 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
1430 {
1431 XmlSerializer serializer = new XmlSerializer(typeof(GetOrderStatusesCall.Response));
1432 set = (GetOrderStatusesCall.Response)serializer.Deserialize(ms);
1433 }               
1434
1435 }
1436 catch (Exception ex)
1437 {
1438 #region handle exception
1439
1440 set.Status = new BusinessEntities.LabRestService.GetOrderStatusesCall.ResponseStatus();
1441 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1442 set.Status.ErrorMessage = "Exception occurred in GetOrderStatuses (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.ToString();
1443
1444 ex.Data.Add("Response", responseMessage);
1445 ex.Data.Add("WebserviceUsername", WebserviceUsername);
1446 ex.Data.Add("WebservicePassword", WebservicePassword);
1447 ex.Data.Add("CustomerUsername", CustomerUsername);
1448 ex.Data.Add("customerid", customerid);
1449 ex.Data.Add("lastModified", formattedTimestamp);
1450 ex.Data.Add("Result", set);
1451
1452 throw;
1453 #endregion
1454 }
1455
1456 return set;
1457 }       
1458
1459 == Response Status XML Example ==
1460
1461 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1462 <Response>
1463 <Orders>
1464 <Order>
1465 <OrderStatus>Reported</OrderStatus>
1466 <SIKBOrderId></SIKBOrderId>
1467 <SIKBOrderStatus>5</SIKBOrderStatus>
1468 <OrderId>4855422</OrderId>
1469 <RapportNummer>12193838</RapportNummer>
1470 <IsDelayed>False</IsDelayed>
1471 <ExpectedOn>09/10/2015 17:15:00</ExpectedOn>
1472 </Order>
1473 <Order>
1474 <OrderStatus>New</OrderStatus>
1475 <SIKBOrderId></SIKBOrderId>
1476 <SIKBOrderStatus>3</SIKBOrderStatus>
1477 <OrderId>7106525</OrderId>
1478 <RapportNummer>02808304-0749-41ae-96eb-d62b0365ebe4</RapportNummer>
1479 <IsDelayed>False</IsDelayed>
1480 <ExpectedOn></ExpectedOn>
1481 </Order>
1482 <Order>
1483 <OrderStatus>New</OrderStatus>
1484 <SIKBOrderId></SIKBOrderId>
1485 <SIKBOrderStatus>3</SIKBOrderStatus>
1486 <OrderId>7108954</OrderId>
1487 <RapportNummer>10776137-ef99-4947-9a6a-9a3b32cd2dec</RapportNummer>
1488 <IsDelayed>False</IsDelayed>
1489 <ExpectedOn></ExpectedOn>
1490 </Order>
1491 <Order>
1492 <OrderStatus>New</OrderStatus>
1493 <SIKBOrderId></SIKBOrderId>
1494 <SIKBOrderStatus>3</SIKBOrderStatus>
1495 <OrderId>7110401</OrderId>
1496 <RapportNummer>7881575c-bee2-409f-b304-9e472e7ac702</RapportNummer>
1497 <IsDelayed>False</IsDelayed>
1498 <ExpectedOn>11/10/2018 00:00:00</ExpectedOn>
1499 </Order>
1500 </Orders>
1501 <Status>
1502 <StatusCode>1</StatusCode>
1503 <StatusCodeDescription>OK</StatusCodeDescription>
1504 <AtmisErrorCode>0</AtmisErrorCode>
1505 <ErrorMessage></ErrorMessage>
1506 </Status>
1507 </Response>
1508
1509
1510 == Request example Order XML ==
1511
1512
1513 public GetOrderResultsCall.Response GetOrderResults(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, string orderid, string sikbVersion)
1514 {
1515 GetOrderResultsCall.Response set = new GetOrderResultsCall.Response();
1516 string responseMessage = null;
1517 try
1518 {
1519 bool useZipstream = true;
1520 var content = new FormUrlEncodedContent(new[]
1521 {
1522 new KeyValuePair<string, string>("userName", WebserviceUsername),
1523 new KeyValuePair<string, string>("password", WebservicePassword),
1524 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
1525 new KeyValuePair<string, string>("clientId", customerid),
1526 new KeyValuePair<string, string>("orderId", orderid),
1527 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
1528 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
1529 });
1530
1531 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetOrderResults", content).GetAwaiter().GetResult();
1532 responseMessage = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
1533 response.EnsureSuccessStatusCode();
1534
1535 if (string.IsNullOrEmpty(responseMessage))
1536 {
1537 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetOrderResults" + "]");
1538 }
1539 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
1540 {
1541 XmlSerializer serializer = new XmlSerializer(typeof(GetOrderResultsCall.Response));
1542 set = (GetOrderResultsCall.Response)serializer.Deserialize(ms);
1543 }
1544
1545 if (useZipstream && !string.IsNullOrEmpty(set.FileContent))
1546 {
1547 ~/~/convert from base64 string back to normal
1548 ~/~/first check for real Base64, by checking there is no 'xml' in it
1549 ~/~/If encoded, it wont contain either of the root XML tags of SIKB
1550 if (!set.FileContent.Contains("FeatureCollectionIMSIKB0101") && !set.FileContent.Contains("labresultaat"))
1551 {
1552 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);
1553 }
1554 }
1555
1556 }
1557 catch (Exception ex)
1558 {
1559 #region handle exception
1560
1561 set.Status = new BusinessEntities.LabRestService.GetOrderResultsCall.ResponseStatus();
1562 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1563 set.Status.ErrorMessage = "Exception occurred in GetOrderResults (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.ToString();
1564
1565 ex.Data.Add("Response", responseMessage);
1566 ex.Data.Add("WebserviceUsername", WebserviceUsername);
1567 ex.Data.Add("WebservicePassword", WebservicePassword);
1568 ex.Data.Add("CustomerUsername", CustomerUsername);
1569 ex.Data.Add("sikbVersion", sikbVersion);
1570 ex.Data.Add("customerid", customerid);
1571 ex.Data.Add("orderId", orderid);
1572 ex.Data.Add("Result", set);
1573
1574 throw;
1575 #endregion
1576 }
1577
1578 return set;
1579
1580
1581 == Response Order XML Example ==
1582
1583
1584 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1585 <Response>
1586 <FileContent>DhVn3Q1AA==</FileContent>  ~/~/BASE64 Zip Stream, SIKB0101 labresults xml file
1587 <Status>
1588 <StatusCode>1</StatusCode>
1589 <StatusCodeDescription>OK</StatusCodeDescription>
1590 <AtmisErrorCode>0</AtmisErrorCode>  
1591 <ErrorMessage></ErrorMessage>
1592 </Status>
1593 </Response>
1594
1595
1596 == Request example Order PDF File ==
1597
1598
1599
1600 bool useZipstream = true; ~/~/ Always Supported, Keep it true!!
1601 var content = new FormUrlEncodedContent(new[]
1602 {
1603 new KeyValuePair<string, string>("userName", WebserviceUsername),
1604 new KeyValuePair<string, string>("password", WebservicePassword),
1605 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
1606 new KeyValuePair<string, string>("clientId", customerid),
1607 new KeyValuePair<string, string>("orderId", orderid),
1608 new KeyValuePair<string, string>("useZip", useZipstream.ToString()), ~/~/ Always Supported, Keep it true!!.
1609 new KeyValuePair<string, string>("languageCode", languageCode)
1610 });
1611
1612 HttpResponseMessage response = _HttpClient.PostAsync("GetOrderPdf", content).GetAwaiter().GetResult();
1613 responseMessage = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
1614 response.EnsureSuccessStatusCode();
1615
1616
1617 == Response Order PDF Example ==
1618
1619 <Response>
1620 <OrderId>7113737</OrderId>
1621 <FileContent>
1622 BASE64 encoded file
1623 </FileContent>
1624 <Status>
1625 <StatusCode>1</StatusCode>
1626 <StatusCodeDescription>OK</StatusCodeDescription>
1627 <AtmisErrorCode>0</AtmisErrorCode>
1628 <ErrorMessage></ErrorMessage>
1629 </Status>
1630 </Response>
1631
1632
1633
1634 (% element-id="357" %)
1635 = (% element-id="356" %)Customer wants to see real time information about the status in the interface(%%) =
1636
1637 (% element-id="354" %)
1638 == (% element-id="353" %)Solution/Design(%%) ==
1639
1640 (% element-id="352" %)
1641 To always show up-to-date information in the TerraIndex interface when a user opens a lab assignment to see the status, we reuse part of the GetOrderStatus, but with a specific OrderID.
1642
1643 (% element-id="351" %)
1644 ..NOT SUPPORTED YET...
1645
1646 (% class="table-hover" element-id="350" %)
1647 (% element-id="348" %)|(% colspan="1" element-id="347" %)Action|(% colspan="1" element-id="346" %)TerraIndex|(% colspan="1" element-id="345" %) |(% colspan="1" element-id="343" %)Laboratorium|(% colspan="1" element-id="342" %)Parameters/Message|(% colspan="1" element-id="341" %)Remarks|(% colspan="1" element-id="340" %)ResultCodes
1648 (% element-id="339" %)|(% element-id="338" %)1|(% element-id="337" %)Request the Order status for a single Order/Labassignment.
1649 Function: GetOrderStatus()|=(% element-id="335" %)>|(% element-id="334" %) |(% element-id="332" %)WebserviceUsername (string), 
1650 WebservicePassword (string),
1651 CustomerUsername (string),
1652 CustomerCode (string),
1653 OrderID (string),|(% element-id="327" %) |(% element-id="325" %)
1654 (% element-id="323" %)|(% element-id="322" %)2|(% element-id="321" %) |(% element-id="319" %) |(% element-id="317" %)Receives the request and gets the status for the Order.|(% element-id="316" %) |(% element-id="314" %) |(% element-id="312" %)
1655 (% element-id="310" %)|(% element-id="309" %)3|(% element-id="308" %) |(% element-id="306" %)<=|(% element-id="305" %)Sends back the status of the order.|(% element-id="304" %)ResultCode (),
1656 ErrorMessage (string),
1657 OrderID (string),
1658 LabassignmentGUID (GUID),
1659 CertificateNumber (string)
1660 OrderStatusSIKB (int),
1661 Delayed (boolean),
1662 ExpectedTimeStamp (DateTime),|(% element-id="296" %)OrderStatusSIKB is the SIKB Labassignment status.
1663 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1664 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1665 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="290" %)1 = Success,
1666 2 = GeneralError,
1667 3 = WrongSIKBVersion,
1668 4 = InvalidCredentials,
1669 5 = CustomerUsernameInvalid,
1670 6 = CustomerUsernameNotValidForCustomerCode
1671 7 = FileContentProblem,
1672 8 = InvalidOrderId,
1673 9 = OrderIdAlreadyApproved
1674 10 = PDFNotAvailable
1675 (% element-id="280" %)|(% element-id="279" %)4|(% element-id="278" %)Receives the status and shows in the interface the updated info.
1676 Update the CertificateNr if this is not already present in the labassignment. |(% element-id="276" %) |(% element-id="274" %) |(% element-id="272" %) |(% element-id="270" %)CertifcateNumber could be new here, if the lab wasn't able to fill it directly at the ApproveOrder.|(% element-id="269" %)
1677
1678 (% element-id="265" %)
1679