Changes for page Validation

Last modified by Danniar Firdausy on 2024/09/19 08:56

From version 25.1
edited by Erik Bakker
on 2022/09/01 08:29
Change comment: There is no comment for this version
To version 20.1
edited by eMagiz
on 2022/05/22 21:17
Change comment: There is no comment for this version

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,0 @@
1 -Validation
Parent
... ... @@ -1,1 +1,0 @@
1 -WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ebakker
1 +XWiki.marijn
Default language
... ... @@ -1,1 +1,0 @@
1 -en
Content
... ... @@ -1,8 +1,20 @@
1 -{{container}}{{container layoutStyle="columns"}}(((
1 +{{html wiki="true"}}
2 +<div class="ez-academy">
3 + <div class="ez-academy_body">
4 +
5 +<div class="doc">
6 +
7 +
8 +
9 += Validation =
10 +
2 2  In the previous microlearning, we learned how to configure a REST service. In this microlearning, we will discuss how you can validate whether the party calling your REST endpoint is sending the correct information in terms of the structure of the message. We will also learn how you can subsequently report back to the client that a validation error occurred.
3 3  
4 -Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]].
13 +Should you have any questions, please get in touch with academy@emagiz.com.
5 5  
15 +* Last update: September 8th, 2021
16 +* Required reading time: 5 minutes
17 +
6 6  == 1. Prerequisites ==
7 7  
8 8  * Intermediate knowledge of the eMagiz platform
... ... @@ -17,6 +17,8 @@
17 17  * When doing so, the external application should adhere to the defined data structure
18 18  * If not, we need to refuse the call and respond with an error message
19 19  
32 +
33 +
20 20  == 3. Validation ==
21 21  
22 22  In the previous microlearning, we learned how to configure a REST service. In this microlearning, we will discuss how you can validate whether the party calling your REST endpoint is sending the correct information in terms of the structure of the message. We will also learn how you can subsequently report back to the client that a validation error occurred.
... ... @@ -25,11 +25,11 @@
25 25  
26 26  When adding or checking the XML validating filter, ensure that the checkbox (Throw an exception on rejection) is activated when the validation is done outside the all-entry.
27 27  
28 -[[image:Main.Images.Microlearning.WebHome@intermediate-rest-webservice-connectivity-validation--exception-on-rejection.png]]
42 +<p align="center">[[image:intermediate-rest-webservice-connectivity-validation--exception-on-rejection.png||]]</p>
29 29  
30 30  As a result, the error handling will be triggered. In the case of an API Gateway solution, the error will automatically be given back to the previous step in the process. And since we advise validating the entry in case of messaging, we can send the message to the discard channel. Knowing that, we now need to follow that up. Since we need to give back the error to the client, the logical next step needs to happen in our all-entry. Here we need to make a distinction between validation errors and generic errors. We can do so by using an XPath router within the all-entry.
31 31  
32 -[[image:Main.Images.Microlearning.WebHome@intermediate-rest-webservice-connectivity-validation--xpath-router-configuration.png]]
46 +<p align="center">[[image:intermediate-rest-webservice-connectivity-validation--xpath-router-configuration.png||]]</p>
33 33  
34 34  With the help of this configuration and a default output channel that leads to the generic setup (500 error), you can ensure that when an XML validating filter returns a validation error, you can define another HTTP status code and a different response body. You can use similar logic as with the generic setup for the 500 error. For specific information in setting that up please check out this [microlearning](intermediate-rest-webservice-connectivity-configuration.md).
35 35  
... ... @@ -37,6 +37,8 @@
37 37  
38 38  if (exists(//err:xml-validation-exception)) then 'validation' else if (exists(//err:exception[@class='org.springframework.integration.MessageTimeoutException'])) then 'timeout' else ''
39 39  
54 +===== Practice =====
55 +
40 40  == 4. Assignment ==
41 41  
42 42  Navigate to a flow within your (Academy) project in which you host a REST Webservice.
... ... @@ -51,6 +51,8 @@
51 51  * eMagiz auto generates a lot when using the API Gateway
52 52  * You need to recreate this when using the same functionality in a messaging flow
53 53  
70 +
71 +
54 54  == 6. Suggested Additional Readings ==
55 55  
56 56  If you are interested in this topic and want more information, please read the help text provided by eMagiz.
... ... @@ -59,4 +59,9 @@
59 59  
60 60  Please check out the store for a working example for a messaging solution.
61 61  
62 -)))((({{toc/}}))){{/container}}{{/container}}
80 +</div>
81 +
82 +</div>
83 +</div>
84 +
85 +{{/html}}