Version 20.1 by Robin Huisman on 2024/06/27 11:09

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 (% element-id="1873" %)
49 Test outbound
50 13.73.138.173
51
52 (% element-id="1871" %)
53 CD/CI outbound
54 40.114.238.16
55
56 (% element-id="1869" %)
57 Office outbound
58 213.124.115.132
59
60
61 (% element-id="1864" %)
62 = (% element-id="1863" %)Labdelivery (menu-card) files Exchange(%%) =
63
64 (% element-id="1862" %)
65 == (% element-id="1861" %)Solution/Design(%%) ==
66
67
68 (% class="table-hover" element-id="1858" %)
69 (% 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**
70 (% 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), **(%%)
71 (% element-id="1832" %)**WebservicePassword (string),**(%%)
72 (% element-id="1830" %)**CustomerUsername (string)**|(% element-id="1829" %) |(% element-id="1827" %)
73 (% 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" %)
74 (% 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 (),
75 ErrorMessage (string),
76 List<customer> , Customer:
77 CustomerCode (string),
78 CustomerName (string),
79 LabID (int),
80 LabName (string),
81 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,
82 2 = GeneralError,
83 3 = WrongSIKBVersion,
84 4 = InvalidCredentials,
85 5 = CustomerUsernameInvalid,
86 6 = CustomerUsernameNotValidForCustomerCode
87 7 = FileContentProblem,
88 8 = InvalidOrderId,
89 9 = OrderIdAlreadyApproved
90 10 = PDFNotAvailable
91 (% 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" %)
92 (% 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), **(%%)
93 (% element-id="1766" %)**WebservicePassword (string),**(%%)
94 (% element-id="1764" %)**CustomerUsername (string),**(%%)
95 LabID (int),
96 CustomerCode (string),
97 LanguageCode (string, default 'nld' volgens ISO 639-3-codes),
98 SIKBVersion (string, default: '13.4.0'),
99 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1758" %)(% element-id="1757" %)
100 (((
101 (% element-id="1756" %)
102 We start with dutch, then extend with multiple languages, TerraIndex is in the lead to request multiple languages.
103 TerraIndex uses: 'fra', 'nld', 'eng', 'spa', 'deu', 'ita', 'por', 'dan'
104
105
106 (% element-id="1752" %)
107 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0/8.0.0 etc.
108
109 (% element-id="1752" %)
110 ~==> nle Do you want to mention these old versions?
111 )))|(% element-id="1751" %)
112 (% 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" %)
113 (% 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 (),
114 ErrorMessage (string),
115 FileContent_Base64 (string),
116 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1726" %) |(% element-id="1724" %)1 = Success,
117 2 = GeneralError,
118 3 = WrongSIKBVersion,
119 4 = InvalidCredentials,
120 5 = CustomerUsernameInvalid,
121 6 = CustomerUsernameNotValidForCustomerCode
122 7 = FileContentProblem,
123 8 = InvalidOrderId,
124 9 = OrderIdAlreadyApproved
125 10 = PDFNotAvailable
126 (% 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" %)
127 (% 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" %)
128 (% 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" %)
129
130 (% element-id="1675" %)
131 == (% element-id="1674" %)Get Customers (POST)(%%) ==
132
133 (% element-id="1673" %)
134 === (% element-id="1672" %)Request example(%%) ===
135
136 (% element-id="1671" %)
137 (% element-id="1669" %)|(% element-id="1668" %)(% element-id="1667" %)
138 (((
139 {{code language="C#"}}
140 public GetCustomersCall.Response GetCustomers(string WebserviceUsername, string WebservicePassword, string CustomerUsername)
141         {
142             GetCustomersCall.Response set = new GetCustomersCall.Response();
143
144             try
145             {
146                 var content = new FormUrlEncodedContent(new[]
147                 {
148                     new KeyValuePair<string, string>("userName", WebserviceUsername),
149                     new KeyValuePair<string, string>("password", WebservicePassword),
150                     new KeyValuePair<string, string>("customerUsername", CustomerUsername),
151                 });
152
153                 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result;
154                 response.EnsureSuccessStatusCode();
155                 string responseMessage = response.Content.ReadAsStringAsync().Result;
156
157                 if (string.IsNullOrEmpty(responseMessage))
158                 {
159                     throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / GetCustomers" + "]");
160                 }
161                 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage)))
162                 {
163                     XmlSerializer serializer = new XmlSerializer(typeof(GetCustomersCall.Response));
164                     set = (GetCustomersCall.Response)serializer.Deserialize(ms);                 
165                 }
166             }
167             catch (Exception ex)
168             {
169                 #region handle exception
170                 set.Status = new BusinessEntities.LabRestService.GetCustomersCall.ResponseStatus();
171                 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();               
172                 set.Status.ErrorMessage = "Exception occurred in GetCustomers (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
173                 ex.Data.Add("WebserviceUsername", WebserviceUsername);
174                 ex.Data.Add("WebservicePassword", WebservicePassword);
175                 ex.Data.Add("CustomerUsername", CustomerUsername);
176                 ExceptionHandler.HandleException(ex);
177                 #endregion
178             }
179             return set;
180         }
181 {{/code}}
182
183 (% element-id="1566" %)
184
185 )))
186
187 (% element-id="1564" %)
188 (% element-id="1562" %)|(% element-id="1561" %)(% element-id="1560" %)
189 (((
190 (% element-id="1559" %)
191 POST https:~/~/<URL>/GetCustomers HTTP/1.1
192
193 (% element-id="1558" %)
194 Content-Type: application/x-www-form-urlencoded
195
196 (% element-id="1557" %)
197 Host: 81.175.89.24
198
199 (% element-id="1556" %)
200 Content-Length: 115
201
202 (% element-id="1555" %)
203 Expect: 100-continue
204
205
206 (% element-id="1552" %)
207 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>
208 )))
209
210 (% element-id="1551" %)
211 === (% element-id="1550" %)Response example(%%) ===
212
213 (% element-id="1549" %)
214 (% element-id="1547" %)|(% element-id="1546" %)(% element-id="1545" %)
215 (((
216 {{code language="XML"}}
217 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
218 <Response><Customers>
219   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="300" CustomerName="Adviesbureau De bodemkoning - Rotterdam" LastModifiedOnClient="2019-05-08T11:05:14.17+02:00" ></Customer>
220   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="656" CustomerName="Adviesbureau De bodemkoning - Delft" LastModifiedOnClient="2019-04-19T13:20:10.123+02:00" ></Customer>
221 </Customers>
222 <Status>
223     <StatusCode>1</StatusCode>
224     <StatusCodeDescription>OK</StatusCodeDescription>
225     <ErrorMessage></ErrorMessage>
226 </Status>
227 </Response>
228 {{/code}}
229
230 (% element-id="1492" %)
231
232 )))
233
234 (% element-id="1490" %)
235 == (% element-id="1489" %)Get Products (POST)(%%) ==
236
237 (% element-id="1488" %)
238 === (% element-id="1487" %)Request example(%%) ===
239
240 (% element-id="1486" %)
241 (% element-id="1484" %)|(% element-id="1483" %)(% element-id="1482" %)
242 (((
243 (% element-id="1481" %)
244 public GetProductsCall.Response GetProductList(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, int labid, string sikbVersion, string languageCode)
245
246 (% element-id="1480" %)
247 {
248
249
250 (% element-id="1477" %)
251 GetProductsCall.Response set = new GetProductsCall.Response();
252
253
254 (% element-id="1474" %)
255 try
256
257 (% element-id="1473" %)
258 {
259
260 (% element-id="1472" %)
261 bool useZipstream = true;
262
263 (% element-id="1471" %)
264 var content = new FormUrlEncodedContent(new[]
265
266 (% element-id="1470" %)
267 {
268
269 (% element-id="1469" %)
270 new KeyValuePair<string, string>("userName", WebserviceUsername),
271
272 (% element-id="1468" %)
273 new KeyValuePair<string, string>("password", WebservicePassword),
274
275 (% element-id="1467" %)
276 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
277
278 (% element-id="1466" %)
279 new KeyValuePair<string, string>("languageCode", languageCode),
280
281 (% element-id="1465" %)
282 new KeyValuePair<string, string>("clientId", customerid),
283
284 (% element-id="1464" %)
285 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
286
287 (% element-id="1463" %)
288 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
289
290 (% element-id="1462" %)
291 });
292
293
294 (% element-id="1459" %)
295 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetProducts", content).Result;
296
297 (% element-id="1458" %)
298 response.EnsureSuccessStatusCode();
299
300 (% element-id="1457" %)
301 string responseMessage = response.Content.ReadAsStringAsync().Result;
302
303
304 (% element-id="1454" %)
305 if (string.IsNullOrEmpty(responseMessage))
306
307 (% element-id="1453" %)
308 {
309
310 (% element-id="1452" %)
311 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetProducts" + "]");
312
313 (% element-id="1451" %)
314 }
315
316 (% element-id="1450" %)
317 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
318
319 (% element-id="1449" %)
320 {
321
322 (% element-id="1448" %)
323 XmlSerializer serializer = new XmlSerializer(typeof(GetProductsCall.Response));
324
325 (% element-id="1447" %)
326 set = (GetProductsCall.Response)serializer.Deserialize(ms);
327
328 (% element-id="1446" %)
329 }
330
331
332 (% element-id="1443" %)
333 if (useZipstream && !string.IsNullOrEmpty(set.FileContent))
334
335 (% element-id="1442" %)
336 {
337
338 (% element-id="1441" %)
339 ~/~/convert from base64 string back to normal
340
341 (% element-id="1440" %)
342 ~/~/first check for real Base64, by checking there is no 'xml'  in it
343
344 (% element-id="1439" %)
345 if (!set.FileContent.Contains("<labaanlevering"))
346
347 (% element-id="1438" %)
348 {
349
350 (% element-id="1437" %)
351 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);
352
353 (% element-id="1436" %)
354 }
355
356 (% element-id="1435" %)
357 }
358
359
360 (% element-id="1432" %)
361 }
362
363 (% element-id="1431" %)
364 catch (Exception ex)
365
366 (% element-id="1430" %)
367 {
368
369 (% element-id="1429" %)
370 #region handle exception
371
372
373 (% element-id="1426" %)
374 set.Status = new BusinessEntities.LabRestService.GetProductsCall.ResponseStatus();
375
376 (% element-id="1425" %)
377 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
378
379 (% element-id="1424" %)
380 set.Status.ErrorMessage = "Exception occurred in GetProducts (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
381
382
383 (% element-id="1421" %)
384 ex.Data.Add("WebserviceUsername", WebserviceUsername);
385
386 (% element-id="1420" %)
387 ex.Data.Add("WebservicePassword", WebservicePassword);
388
389 (% element-id="1419" %)
390 ex.Data.Add("CustomerUsername", CustomerUsername);
391
392 (% element-id="1418" %)
393 ex.Data.Add("sikbVersion", sikbVersion);
394
395 (% element-id="1417" %)
396 ex.Data.Add("customerid", customerid);
397
398 (% element-id="1416" %)
399 ex.Data.Add("languageCode", languageCode);
400
401
402 (% element-id="1413" %)
403 ExceptionHandler.HandleException(ex);
404
405 (% element-id="1412" %)
406 #endregion
407
408 (% element-id="1411" %)
409 }
410
411
412 (% element-id="1408" %)
413 return set;
414
415 (% element-id="1407" %)
416 }
417 )))
418
419 (% element-id="1406" %)
420 (% element-id="1404" %)|(% element-id="1403" %)(% element-id="1402" %)
421 (((
422 (% element-id="1401" %)
423 POST https:~/~/<URL>/GetProducts HTTP/1.1
424
425 (% element-id="1400" %)
426 Content-Type: application/x-www-form-urlencoded
427
428 (% element-id="1399" %)
429 Host: 81.175.89.24
430
431 (% element-id="1398" %)
432 Content-Length: 179
433
434 (% element-id="1397" %)
435 Expect: 100-continue
436
437
438 (% element-id="1394" %)
439 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>&languageCode=nld&clientId=300&sikbVersion=13.5.0&useZip=True
440 )))
441
442 (% element-id="1393" %)
443 === (% element-id="1392" %)Response example(%%) ===
444
445 (% element-id="1391" %)
446 (% element-id="1389" %)|(% element-id="1388" %)(% element-id="1387" %)
447 (((
448 (% element-id="1386" %)
449 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
450
451 (% element-id="1385" %)
452 <Response>
453
454 (% element-id="1384" %)
455 <FileContent> {SIKB FILE in ZIPSTREAM BASE64 format}</FileContent>
456
457 (% element-id="1383" %)
458 <Status>
459
460 (% element-id="1382" %)
461 <StatusCode>1</StatusCode>
462
463 (% element-id="1381" %)
464 <StatusCodeDescription>OK</StatusCodeDescription>
465
466 (% element-id="1380" %)
467 <ErrorMessage></ErrorMessage>
468
469 (% element-id="1379" %)
470 </Status></Response>
471 )))
472
473 (% element-id="1378" %)
474 = (% element-id="1377" %)Useraccount Checkup.(%%) =
475
476 (% element-id="1374" %)
477 == (% element-id="1373" %)Solution/Design(%%) ==
478
479 (% element-id="1372" %)
480 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.
481
482 (% element-id="1371" %)
483 WebserviceUsername (string),
484 WebservicePassword (string),
485 CustomerUsername (string)
486
487
488 (% element-id="1366" %)
489 Therefore we call a Webserice for ValidCredentials Check:
490
491
492 (% class="table-hover" element-id="1363" %)
493 (% 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**
494 (% 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),
495 WebservicePassword (string),
496 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" %)
497 (% 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" %)
498 (% 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 (),
499 ErrorMessage (string),|(% element-id="1313" %) |(% element-id="1311" %)1 = Success,
500 2 = GeneralError,
501 3 = WrongSIKBVersion,
502 4 = InvalidCredentials,
503 5 = CustomerUsernameInvalid,
504 6 = CustomerUsernameNotValidForCustomerCode
505 7 = FileContentProblem,
506 8 = InvalidOrderId,
507 9 = OrderIdAlreadyApproved
508 10 = PDFNotAvailable
509
510 (% element-id="1301" %)
511 == (% element-id="1300" %)Check ValidCredentials (POST)(%%) ==
512
513 (% element-id="1299" %)
514 === (% element-id="1298" %)Request example(%%) ===
515
516 (% element-id="1297" %)
517 (% element-id="1295" %)|(% element-id="1294" %)(% element-id="1293" %)
518 (((
519 (% element-id="1292" %)
520 public ValidCredentialsCall.Response ValidCredentials(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid)
521
522 (% element-id="1291" %)
523 {
524
525 (% element-id="1290" %)
526 ValidCredentialsCall.Response set = new ValidCredentialsCall.Response();
527
528
529 (% element-id="1287" %)
530 try
531
532 (% element-id="1286" %)
533 {
534
535
536 (% element-id="1283" %)
537 var content = new FormUrlEncodedContent(new[]
538
539 (% element-id="1282" %)
540 {
541
542 (% element-id="1281" %)
543 new KeyValuePair<string, string>("userName", WebserviceUsername),
544
545 (% element-id="1280" %)
546 new KeyValuePair<string, string>("password", WebservicePassword),
547
548 (% element-id="1279" %)
549 ~/~/new KeyValuePair<string, string>("clientId", customerid),   ~/~/ Optional
550
551 (% element-id="1278" %)
552 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
553
554 (% element-id="1277" %)
555 });
556
557
558 (% element-id="1274" %)
559 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/ValidCredentials", content).Result;
560
561 (% element-id="1273" %)
562 response.EnsureSuccessStatusCode();
563
564 (% element-id="1272" %)
565 string responseMessage = response.Content.ReadAsStringAsync().Result;
566
567
568 (% element-id="1269" %)
569 if (string.IsNullOrEmpty(responseMessage))
570
571 (% element-id="1268" %)
572 {
573
574 (% element-id="1267" %)
575 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / ValidCredentials" + "]");
576
577 (% element-id="1266" %)
578 }
579
580 (% element-id="1265" %)
581 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
582
583 (% element-id="1264" %)
584 {
585
586 (% element-id="1263" %)
587 XmlSerializer serializer = new XmlSerializer(typeof(ValidCredentialsCall.Response));
588
589 (% element-id="1262" %)
590 set = (ValidCredentialsCall.Response)serializer.Deserialize(ms);
591
592
593 (% element-id="1259" %)
594 return set;
595
596 (% element-id="1258" %)
597 }
598
599
600 (% element-id="1255" %)
601 }
602
603 (% element-id="1254" %)
604 catch (Exception ex)
605
606 (% element-id="1253" %)
607 {
608
609 (% element-id="1252" %)
610 #region handle exception
611
612
613 (% element-id="1249" %)
614 set.Status = new BusinessEntities.LabRestService.ValidCredentialsCall.ResponseStatus();
615
616 (% element-id="1248" %)
617 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
618
619 (% element-id="1247" %)
620 set.Status.ErrorMessage = "Exception occurred in GetValidCredentials (username: " + WebserviceUsername + ", with message: " + ex.Message;
621
622
623 (% element-id="1244" %)
624 ex.Data.Add("WebserviceUsername", WebserviceUsername);
625
626 (% element-id="1243" %)
627 ex.Data.Add("WebservicePassword", WebservicePassword);
628
629 (% element-id="1242" %)
630 ex.Data.Add("CustomerUsername", CustomerUsername);
631
632
633 (% element-id="1239" %)
634 ExceptionHandler.HandleException(ex);
635
636 (% element-id="1238" %)
637 #endregion
638
639 (% element-id="1237" %)
640 }
641
642
643 (% element-id="1234" %)
644 return set;
645
646 (% element-id="1233" %)
647 }
648 )))
649
650 (% element-id="1232" %)
651 (% element-id="1230" %)|(% element-id="1229" %)(% element-id="1228" %)
652 (((
653 (% element-id="1227" %)
654 POST https:~/~/<URL>/ValidCredentials HTTP/1.1
655
656 (% element-id="1226" %)
657 Content-Type: application/x-www-form-urlencoded
658
659 (% element-id="1225" %)
660 Host: 81.175.89.24
661
662 (% element-id="1224" %)
663 Content-Length: 125
664
665 (% element-id="1223" %)
666 Expect: 100-continue
667
668
669 (% element-id="1220" %)
670 userName=<webservice_username>&password=<Webservice_password>&clientId=<optional otherwise empty>&customerUsername=<customer_username or token>
671 )))
672
673 (% element-id="1219" %)
674 === (% element-id="1218" %)Response example(%%) ===
675
676 (% element-id="1217" %)
677 (% element-id="1215" %)|(% element-id="1214" %)(% element-id="1213" %)
678 (((
679 (% element-id="1212" %)
680 <?xml version="1.0" encoding="UTF-8" standalone="no"?><Response>
681
682 (% element-id="1211" %)
683 <Status>
684
685 (% element-id="1210" %)
686 <StatusCode>1</StatusCode>
687
688 (% element-id="1209" %)
689 <StatusCodeDescription>OK</StatusCodeDescription>
690
691 (% element-id="1208" %)
692 <ErrorMessage></ErrorMessage>
693
694 (% element-id="1207" %)
695 </Status>
696
697 (% element-id="1206" %)
698 </Response>
699 )))
700
701 (% element-id="1205" %)
702 = (% element-id="1204" %)Labassignment request delivery(POST)(%%) =
703
704 (% element-id="1203" %)
705 == (% element-id="1202" %)Solution/Design(%%) ==
706
707 (% element-id="1201" %)
708 For this we create a Webservice for CreateOrder to create the order in the lab system.
709 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.
710 Depending on the user's choice at the laboratory, to support this or not, TerraIndex calls the ApproveOrder or the CancelOrder.
711
712 (% element-id="0" %)
713 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.
714
715
716 (% class="table-hover" element-id="1195" %)
717 (% 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**
718 (% 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),
719 WebservicePassword (string),
720 CustomerUsername (string),
721 FileContent_Base64 (string),
722 UseZipStream/UseZip (bool, default: 'false'),
723 CustomerCode (string),
724 SIKBVersion (string, default: '13.4.0'),
725 needsApprovalIsSupported (bool)|(% element-id="1164" %)SIKB Version included, so labs can quickly check the version.
726 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0.
727 \\Before sending the SIKB, validate to the XSD!
728 And to the XSLT?
729 \\needsApprovalIsSupported = false; means we dont get PDF with offerte. This will make is faster.
730 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" %)
731 (% 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" %)
732 (% 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.
733 Otherwise we use the idanlmons unique ID.|(% colspan="1" element-id="1130" %)
734 (% 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" %)
735 (% 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 (),
736 ErrorMessage (string),
737 OrderId (string),
738 NeedsApprove (bool),
739 FileContent_Base64 (string),
740 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,
741 2 = GeneralError,
742 3 = WrongSIKBVersion,
743 4 = InvalidCredentials,
744 5 = CustomerUsernameInvalid,
745 6 = CustomerUsernameNotValidForCustomerCode
746 7 = FileContentProblem,
747 8 = InvalidOrderId,
748 9 = OrderIdAlreadyApproved
749 10 = PDFNotAvailable
750 (% element-id="1091" %)|(% colspan="1" element-id="1090" %)6|(% colspan="1" element-id="1089" %)Receives the OrderId, and saves it.
751 |(% colspan="1" element-id="1086" %) |(% colspan="1" element-id="1084" %) |(% colspan="1" element-id="1082" %) |(% colspan="1" element-id="1080" %)(% element-id="1079" %)
752 (((
753 (% element-id="1078" %)
754 Default for now laboratorium will send:
755 NeedsApprove = False,
756 PDF = Empty,
757 Zipstream = False,
758
759
760 (% element-id="1072" %)
761 In the future, do something with the PDF and show the PDF to users to Approve or Cancel.
762 This will be done by; NeedsApprove = true.
763 \\If NeedsApprove is False, the order is Processed and can't be changed in TI. Like it is now.
764
765 (% element-id="1068" %)
766
767 )))|(% colspan="1" element-id="1066" %)
768 (% 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" %)
769 (% 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" %)
770 (% 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" %)
771 (% 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),
772 WebservicePassword (string),
773 CustomerUsername (string),
774 OrderId (string)|(% colspan="1" element-id="1009" %) |(% colspan="1" element-id="1007" %)
775 (% 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" %)
776 (% 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 (),
777 ErrorMessage (string),
778 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,
779 2 = GeneralError,
780 3 = WrongSIKBVersion,
781 4 = InvalidCredentials,
782 5 = CustomerUsernameInvalid,
783 6 = CustomerUsernameNotValidForCustomerCode
784 7 = FileContentProblem,
785 8 = InvalidOrderId,
786 9 = OrderIdAlreadyApproved
787 10 = PDFNotAvailable
788 (% 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" %)
789 (% 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" %)
790 (% 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" %)
791 (% 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),
792 WebservicePassword (string),
793 CustomerUsername (string),
794 OrderId (string)|(% element-id="919" %) |(% element-id="917" %)
795 (% 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" %)
796 (% element-id="902" %)|(% element-id="901" %)9|(% element-id="900" %) |(% element-id="898" %)<=|(% element-id="897" %)Sends back a Success |(% element-id="896" %)ResultCode (),
797 ErrorMessage (string)|(% element-id="894" %) |(% element-id="892" %)1 = Success,
798 2 = GeneralError,
799 3 = WrongSIKBVersion,
800 4 = InvalidCredentials,
801 5 = CustomerUsernameInvalid,
802 6 = CustomerUsernameNotValidForCustomerCode
803 7 = FileContentProblem,
804 8 = InvalidOrderId,
805 9 = OrderIdAlreadyApproved
806 10 = PDFNotAvailable
807 (% 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" %)
808 (% 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" %)
809
810 (% element-id="855" %)
811 == (% element-id="854" %)Create Order(%%) ==
812
813 (% element-id="853" %)
814 === (% element-id="852" %)Request example(%%) ===
815
816 (% element-id="851" %)
817 (% element-id="849" %)|(% element-id="848" %)(% element-id="847" %)
818 (((
819 (% element-id="846" %)
820 public CreateOrderResponse.Response SendLabAssignment(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, string sikbVersion, string assignmentXML, string languageCode, bool needsApprovalIsSupported = false)
821
822 (% element-id="845" %)
823 {
824
825 (% element-id="844" %)
826 CreateOrderResponse.Response set = new CreateOrderResponse.Response();
827
828
829 (% element-id="841" %)
830 try
831
832 (% element-id="840" %)
833 {
834
835 (% element-id="839" %)
836 bool useZipstream = true;
837
838
839 (% element-id="836" %)
840 MultipartFormDataContent content = new MultipartFormDataContent();
841
842
843 (% element-id="833" %)
844 ~/~/Add Formdata
845
846 (% element-id="832" %)
847 var formDataDictionary = new[]
848
849 (% element-id="831" %)
850 {
851
852 (% element-id="830" %)
853 new KeyValuePair<string, string>("userName", WebserviceUsername),
854
855 (% element-id="829" %)
856 new KeyValuePair<string, string>("password", WebservicePassword),
857
858 (% element-id="828" %)
859 new KeyValuePair<string, string>("customerUserName", CustomerUsername),
860
861 (% element-id="827" %)
862 new KeyValuePair<string, string>("clientId", customerid),
863
864 (% element-id="826" %)
865 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
866
867 (% element-id="825" %)
868 new KeyValuePair<string, string>("languageCode", languageCode),
869
870 (% element-id="824" %)
871 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
872
873 (% element-id="823" %)
874 new KeyValuePair<string, string>("needsApprovalIsSupported", needsApprovalIsSupported.ToString() ),
875
876 (% element-id="822" %)
877 ~/~/new KeyValuePair<string, string>("orderXml", ZipStreamHelper.CompressToBase64String(assignmentXML)),
878
879 (% element-id="821" %)
880 ~/~/new KeyValuePair<string, string>("orderXml", assignmentXML),
881
882 (% element-id="820" %)
883 };              
884
885 (% element-id="819" %)
886 foreach (var item in formDataDictionary)
887
888 (% element-id="818" %)
889 {
890
891 (% element-id="817" %)
892 content.Add(new StringContent(item.Value), $"\"{item.Key}\"");
893
894 (% element-id="816" %)
895 }
896
897
898 (% element-id="813" %)
899 string filexml = string.Empty;
900
901 (% element-id="812" %)
902 if (useZipstream)
903
904 (% element-id="811" %)
905 {
906
907 (% element-id="810" %)
908 filexml = ZipStreamHelper.CompressToBase64String(assignmentXML);
909
910 (% element-id="809" %)
911 }
912
913 (% element-id="808" %)
914 else
915
916 (% element-id="807" %)
917 {
918
919 (% element-id="806" %)
920 filexml = assignmentXML;
921
922 (% element-id="805" %)
923 }
924
925
926 (% element-id="802" %)
927 ~/~/Add filecontent
928
929 (% element-id="801" %)
930 var fileContent = new ByteArrayContent(ZipStreamHelper.stringToByteArray(filexml));
931
932 (% element-id="800" %)
933 fileContent.Headers.ContentDisposition =
934
935 (% element-id="799" %)
936 new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") ~/~/<- 'form-data' instead of 'attachment'
937
938 (% element-id="798" %)
939 {
940
941 (% element-id="797" %)
942 Name = "\"orderXml\"", ~/~/ \" is needed so the message contains the quotes, wihtout it will fail
943
944 (% element-id="796" %)
945 FileName = "\"VivaTerraIndexAssignment.xml\""
946
947 (% element-id="795" %)
948 };
949
950 (% element-id="794" %)
951 fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/xml");              
952
953 (% element-id="793" %)
954 content.Add(fileContent);
955
956
957 (% element-id="790" %)
958 ~/~/Start sending
959
960
961 (% element-id="787" %)
962 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/CreateOrder", content).Result;
963
964 (% element-id="786" %)
965 response.EnsureSuccessStatusCode();
966
967 (% element-id="785" %)
968 string responseMessage = response.Content.ReadAsStringAsync().Result;
969
970
971 (% element-id="782" %)
972 if (string.IsNullOrEmpty(responseMessage))
973
974 (% element-id="781" %)
975 {
976
977 (% element-id="780" %)
978 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /CreateOrder" + "]");
979
980 (% element-id="779" %)
981 }
982
983 (% element-id="778" %)
984 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
985
986 (% element-id="777" %)
987 {
988
989 (% element-id="776" %)
990 XmlSerializer serializer = new XmlSerializer(typeof(CreateOrderResponse.Response));
991
992 (% element-id="775" %)
993 set = (CreateOrderResponse.Response)serializer.Deserialize(ms);
994
995 (% element-id="774" %)
996 }
997
998
999 (% element-id="771" %)
1000 ~/~/Can contain a PDf with price information
1001
1002 (% element-id="770" %)
1003 if (set.UseZip && !string.IsNullOrEmpty(set.FileContent))
1004
1005 (% element-id="769" %)
1006 {
1007
1008 (% element-id="768" %)
1009 ~/~/convert from base64 string back to normal
1010
1011 (% element-id="767" %)
1012 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);                  
1013
1014 (% element-id="766" %)
1015 }
1016
1017
1018 (% element-id="763" %)
1019 }
1020
1021 (% element-id="762" %)
1022 catch (Exception ex)
1023
1024 (% element-id="761" %)
1025 {
1026
1027 (% element-id="760" %)
1028 #region handle exception
1029
1030
1031 (% element-id="757" %)
1032 set.Status = new BusinessEntities.LabRestService.CreateOrderResponse.ResponseStatus();
1033
1034 (% element-id="756" %)
1035 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1036
1037 (% element-id="755" %)
1038 set.Status.ErrorMessage = "Exception occurred in CreateOrder (username: " + WebserviceUsername + ") with message: " + ex.Message;
1039
1040
1041 (% element-id="752" %)
1042 ex.Data.Add("WebserviceUsername", WebserviceUsername);
1043
1044 (% element-id="751" %)
1045 ex.Data.Add("WebservicePassword", WebservicePassword);
1046
1047 (% element-id="750" %)
1048 ex.Data.Add("CustomerUsername", CustomerUsername);
1049
1050 (% element-id="749" %)
1051 ex.Data.Add("sikbVersion", sikbVersion);
1052
1053 (% element-id="748" %)
1054 ex.Data.Add("customerid", customerid);
1055
1056
1057 (% element-id="745" %)
1058 ExceptionHandler.HandleException(ex);
1059
1060 (% element-id="744" %)
1061 #endregion
1062
1063 (% element-id="743" %)
1064 }
1065
1066
1067 (% element-id="740" %)
1068 return set;
1069
1070 (% element-id="739" %)
1071 }
1072 )))
1073
1074 (% element-id="738" %)
1075 (% element-id="736" %)|(% element-id="735" %)(% element-id="734" %)
1076 (((
1077 (% element-id="733" %)
1078 POST https:~/~/<URL>/CreateOrder HTTP/1.1
1079
1080 (% element-id="732" %)
1081 Content-Type: multipart/form-data; boundary="28a3e130-70c9-4a1a-b544-a802a1ade6ca"
1082
1083 (% element-id="731" %)
1084 Host: 81.175.89.24
1085
1086 (% element-id="730" %)
1087 Content-Length: 5010
1088
1089 (% element-id="729" %)
1090 Expect: 100-continue
1091
1092
1093 (% element-id="726" %)
1094 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1095
1096 (% element-id="725" %)
1097 Content-Type: text/plain; charset=utf-8
1098
1099 (% element-id="724" %)
1100 Content-Disposition: form-data; name="userName"
1101
1102
1103 (% element-id="721" %)
1104 <Webservice_Username>
1105
1106 (% element-id="720" %)
1107 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1108
1109 (% element-id="719" %)
1110 Content-Type: text/plain; charset=utf-8
1111
1112 (% element-id="718" %)
1113 Content-Disposition: form-data; name="password"
1114
1115
1116 (% element-id="715" %)
1117 <Webservice_Password>
1118
1119 (% element-id="714" %)
1120 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1121
1122 (% element-id="713" %)
1123 Content-Type: text/plain; charset=utf-8
1124
1125 (% element-id="712" %)
1126 Content-Disposition: form-data; name="customerUserName"
1127
1128
1129 (% element-id="709" %)
1130 <Customer_Username or token>
1131
1132 (% element-id="708" %)
1133 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1134
1135 (% element-id="707" %)
1136 Content-Type: text/plain; charset=utf-8
1137
1138 (% element-id="706" %)
1139 Content-Disposition: form-data; name="clientId"
1140
1141
1142 (% element-id="703" %)
1143 300
1144
1145 (% element-id="702" %)
1146 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1147
1148 (% element-id="701" %)
1149 Content-Type: text/plain; charset=utf-8
1150
1151 (% element-id="700" %)
1152 Content-Disposition: form-data; name="sikbVersion"
1153
1154
1155 (% element-id="697" %)
1156 13.4.0
1157
1158 (% element-id="696" %)
1159 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1160
1161 (% element-id="695" %)
1162 Content-Type: text/plain; charset=utf-8
1163
1164 (% element-id="694" %)
1165 Content-Disposition: form-data; name="languageCode"
1166
1167
1168 (% element-id="691" %)
1169 nld
1170
1171 (% element-id="690" %)
1172 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1173
1174 (% element-id="689" %)
1175 Content-Type: text/plain; charset=utf-8
1176
1177 (% element-id="688" %)
1178 Content-Disposition: form-data; name="useZip"
1179
1180
1181 (% element-id="685" %)
1182 True
1183
1184 (% element-id="684" %)
1185 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1186
1187 (% element-id="683" %)
1188 Content-Type: text/plain; charset=utf-8
1189
1190 (% element-id="682" %)
1191 Content-Disposition: form-data; name="needsApprovalIsSupported"
1192
1193
1194 (% element-id="679" %)
1195 False
1196
1197 (% element-id="678" %)
1198 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1199
1200 (% element-id="677" %)
1201 Content-Disposition: form-data; name="orderXml"; filename="VivaTerraIndexAssignment.xml"
1202
1203 (% element-id="676" %)
1204 Content-Type: application/xml
1205
1206
1207 (% element-id="673" %)
1208 <SIKB File in Zip stream Base64  encoding>
1209
1210 (% element-id="672" %)
1211 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca~-~-
1212 )))
1213
1214 (% element-id="671" %)
1215 === (% element-id="670" %)Response example(%%) ===
1216
1217 (% element-id="669" %)
1218 (% element-id="667" %)|(% element-id="666" %)(% element-id="665" %)
1219 (((
1220 (% element-id="664" %)
1221 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1222
1223 (% element-id="663" %)
1224 <Response>
1225
1226 (% element-id="662" %)
1227 <OrderId>7113828</OrderId>
1228
1229 (% element-id="661" %)
1230 <NeedsApproval>True</NeedsApproval>
1231
1232 (% element-id="660" %)
1233 <FileContent></FileContent>
1234
1235 (% element-id="659" %)
1236 <Status>
1237
1238 (% element-id="658" %)
1239 <StatusCode>1</StatusCode>
1240
1241 (% element-id="657" %)
1242 <StatusCodeDescription>OK</StatusCodeDescription>
1243
1244 (% element-id="656" %)
1245 <ErrorMessage></ErrorMessage>
1246
1247 (% element-id="655" %)
1248 </Status></Response>
1249 )))
1250
1251 (% element-id="654" %)
1252 = (% element-id="653" %)Get Order status and Results(%%) =
1253
1254 (% element-id="652" %)
1255 == (% element-id="651" %)Solution/Design(%%) ==
1256
1257 (% element-id="650" %)
1258 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.
1259
1260 (% class="table-hover" element-id="647" %)
1261 (% 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
1262 (% 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), 
1263 WebservicePassword (string),
1264 CustomerUsername (string)|(% element-id="627" %)We want to skip the Password of the customer, and we introduce the WebserviceUsername + WebservicePassword.|(% element-id="626" %)
1265 (% 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" %)
1266 (% 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 (),
1267 ErrorMessage (string),
1268 List<customer> , Customer:
1269 CustomerCode (string),
1270 CustomerName (string),
1271 LabID (int),
1272 LabName (string),
1273 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,
1274 2 = GeneralError,
1275 3 = WrongSIKBVersion,
1276 4 = InvalidCredentials,
1277 5 = CustomerUsernameInvalid,
1278 6 = CustomerUsernameNotValidForCustomerCode
1279 7 = FileContentProblem,
1280 8 = InvalidOrderId,
1281 9 = OrderIdAlreadyApproved
1282 10 = PDFNotAvailable
1283 (% 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" %)
1284 (% 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.
1285 Function: GetOrderStatuses()|=(% element-id="569" %)>|(% element-id="568" %) |(% element-id="566" %)WebserviceUsername (string), 
1286 WebservicePassword (string),
1287 CustomerUsername (string),
1288 CustomerCode (string),
1289 LastCheckedTimestamp (DateTime)|(% element-id="561" %)TerraIndex keeps track of the last check timestamp for each license.|(% element-id="560" %)
1290 (% 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" %)
1291 (% 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 (),
1292 ErrorMessage (string),
1293 OrderID (string),
1294 LabassignmentGUID (GUID),
1295 CertificateNumber (string)
1296 OrderStatusSIKB (int),
1297 Delayed (boolean),
1298 ExpectedTimeStamp (DateTime),|(% element-id="531" %)OrderStatusSIKB is the SIKB Labassignment status.
1299 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1300 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1301 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="525" %)1 = Success,
1302 2 = GeneralError,
1303 3 = WrongSIKBVersion,
1304 4 = InvalidCredentials,
1305 5 = CustomerUsernameInvalid,
1306 6 = CustomerUsernameNotValidForCustomerCode
1307 7 = FileContentProblem,
1308 8 = InvalidOrderId,
1309 9 = OrderIdAlreadyApproved
1310 10 = PDFNotAvailable
1311 (% element-id="515" %)|(% element-id="514" %)8|(% element-id="513" %)Receives the list of Orders with status.
1312 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" %)
1313 (% element-id="502" %)|(% element-id="501" %)9|(% element-id="500" %)Send for each Order a call to retreive all results.
1314 Function: GetOrderResults()|=(% element-id="498" %)>|(% element-id="497" %) |(% element-id="495" %)WebserviceUsername (string), 
1315 WebservicePassword (string),
1316 CustomerUsername (string),
1317 CustomerCode (string),
1318 OrderID (string),
1319 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" %)
1320 (% 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" %)
1321 (% 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 (),
1322 ErrorMessage (string),
1323 OrderId (string),
1324 LabassignmentGUID (GUID),
1325 FileContent_Base64 (string),
1326 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="461" %) |(% element-id="459" %)1 = Success,
1327 2 = GeneralError,
1328 3 = WrongSIKBVersion,
1329 4 = InvalidCredentials,
1330 5 = CustomerUsernameInvalid,
1331 6 = CustomerUsernameNotValidForCustomerCode
1332 7 = FileContentProblem,
1333 8 = InvalidOrderId,
1334 9 = OrderIdAlreadyApproved
1335 10 = PDFNotAvailable
1336 (% 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" %)
1337 (((
1338 (% element-id="438" %)
1339 Import will be done to corresponding samples based on:
1340
1341 (% element-id="437" %)
1342 * Find Project by ProjectGUID (as provided in the labassignment)
1343 * Find Project by ProjectCode (as provided in the Labassignment)
1344 * Find Project and Labassignment by LabassignmentGUID (as provided in the Labassignment)
1345 * Find Project (only if Project is not found yet) and Samples based on SampleGUID (as provided in the Labassignment) .
1346 Sample GUIDs that are send to the lab in the labassignment version SIKB 13 or higher are required in the results for labassignment.
1347 For lower version Labassignments the lab should return the 'old' idanlmons as SampleGUID in the XML.
1348 * Find Samples (only if Project is already found ) by SampleName
1349
1350 (% element-id="429" %)
1351 What is imported?
1352
1353 (% element-id="428" %)
1354 * If Sample is found, the results in the XML are always all updated and/or inserted.
1355 * 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)
1356 )))|(% element-id="425" %)
1357 (% element-id="423" %)|(% element-id="422" %)13|(% element-id="421" %)If OrderStatus is 'Completed/Reported' (SIKBID: 5)
1358 Request the PDF certificate.
1359 Function: GetOrderPDF()|=(% element-id="418" %)>|(% element-id="417" %) |(% element-id="415" %)WebserviceUsername (string), 
1360 WebservicePassword (string),
1361 CustomerUsername (string),
1362 CustomerCode (string),
1363 OrderID (string),|(% element-id="410" %) |(% element-id="408" %)
1364 (% 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" %)
1365 (% 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 (),
1366 ErrorMessage (string),
1367 OrderId (string),
1368 LabassignmentGUID (GUID),
1369 FileContent_Base64 (string),
1370 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,
1371 2 = GeneralError,
1372 3 = WrongSIKBVersion,
1373 4 = InvalidCredentials,
1374 5 = CustomerUsernameInvalid,
1375 6 = CustomerUsernameNotValidForCustomerCode
1376 7 = FileContentProblem,
1377 8 = InvalidOrderId,
1378 9 = OrderIdAlreadyApproved
1379 10 = PDFNotAvailable
1380 (% 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" %)
1381
1382 (% element-id="357" %)
1383 = (% element-id="356" %)Customer wants to see real time information about the status in the interface(%%) =
1384
1385 (% element-id="354" %)
1386 == (% element-id="353" %)Solution/Design(%%) ==
1387
1388 (% element-id="352" %)
1389 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.
1390
1391 (% element-id="351" %)
1392 ..NOT SUPPORTED YET...
1393
1394 (% class="table-hover" element-id="350" %)
1395 (% 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
1396 (% element-id="339" %)|(% element-id="338" %)1|(% element-id="337" %)Request the Order status for a single Order/Labassignment.
1397 Function: GetOrderStatus()|=(% element-id="335" %)>|(% element-id="334" %) |(% element-id="332" %)WebserviceUsername (string), 
1398 WebservicePassword (string),
1399 CustomerUsername (string),
1400 CustomerCode (string),
1401 OrderID (string),|(% element-id="327" %) |(% element-id="325" %)
1402 (% 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" %)
1403 (% 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 (),
1404 ErrorMessage (string),
1405 OrderID (string),
1406 LabassignmentGUID (GUID),
1407 CertificateNumber (string)
1408 OrderStatusSIKB (int),
1409 Delayed (boolean),
1410 ExpectedTimeStamp (DateTime),|(% element-id="296" %)OrderStatusSIKB is the SIKB Labassignment status.
1411 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1412 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1413 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="290" %)1 = Success,
1414 2 = GeneralError,
1415 3 = WrongSIKBVersion,
1416 4 = InvalidCredentials,
1417 5 = CustomerUsernameInvalid,
1418 6 = CustomerUsernameNotValidForCustomerCode
1419 7 = FileContentProblem,
1420 8 = InvalidOrderId,
1421 9 = OrderIdAlreadyApproved
1422 10 = PDFNotAvailable
1423 (% element-id="280" %)|(% element-id="279" %)4|(% element-id="278" %)Receives the status and shows in the interface the updated info.
1424 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" %)
1425
1426 (% element-id="265" %)
1427