Changes for page Validate Incoming Messages
Last modified by Erik Bakker on 2024/08/26 12:39
From version 30.2
edited by Erik Bakker
on 2022/06/10 13:23
on 2022/06/10 13:23
Change comment:
Update document after refactoring.
To version 45.1
edited by Erik Bakker
on 2022/12/30 12:12
on 2022/12/30 12:12
Change comment:
There is no comment for this version
Summary
-
Page properties (4 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - novice-file-based-connectivity-characterset1 +Validate Incoming Messages - Parent
-
... ... @@ -1,1 +1,1 @@ 1 -WebHome 1 +Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.WebHome - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,104 +1,79 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 - In somecases, youwanttoreateach uniquepart ofyourinputfileas its messageinsteadofprocessingthecompletefileasits message. In this microlearning, we willlearnhowyou canprocess(large)fileona per-linebasis.2 +When setting up a point at which your customers can talk to you, eMagiz offers various methods of creating such a point. One of those options is to host a SOAP Webservice in eMagiz that handles XML messages asynchronously or synchronously. In this microlearning, we will zoom in on the part that validation of the messages plays when offering such a SOAP web service. 3 3 4 - Shouldyou have any questions,please contact[[academy@emagiz.com>>mailto:academy@emagiz.com]].4 +If you have any questions, don't hesitate to contact academy@emagiz.com. 5 5 6 -* Last update: May 31th, 2021 7 -* Required reading time: 7 minutes 8 - 9 9 == 1. Prerequisites == 10 - 11 11 * Basic knowledge of the eMagiz platform 12 12 13 13 == 2. Key concepts == 10 +This microlearning centers around configuring your SOAP web service. 14 14 15 - Thismicrolearningcenters aroundlearning howto process anincomingfileperline.12 +By configuring, we mean: Designing and determining the characteristics of the SOAP web service. 16 16 17 -By processing per line, we mean: Splitting up the input into discernable pieces that each will become a unique message 14 +Crucial parts in the configuration are: 15 +* Operation Name 16 +* SOAP Webservice Namespace 17 +* Validation 18 +* Authentication 18 18 19 -* Easy way of reading a file line by line and sending it to eMagiz (Low on memory) 20 -* Ability to process each line based on distinctive logic that is relevant on line level 21 -* Can be used for flat file as well as XML input files 20 +Of these four points, we will zoom in on the validation part of our SOAP Webservice in this microlearning. 22 22 23 -== 3. Processing aFileper Line==22 +== 3. Validate Incoming Messages == 24 24 25 - In somecases, youwanttoreateach uniquepart ofyourinputfileas its messageinsteadofprocessingthecompletefileasits message. In this microlearning, we willlearnhowyou canprocess(large)fileona per-linebasis.24 +When setting up a point at which your customers can talk to you, eMagiz offers various methods of creating such a point. One of those options is to host a SOAP Webservice in eMagiz that handles XML messages asynchronously or synchronously. In this microlearning, we will zoom in on the part that validation of the messages plays when offering such a SOAP web service. 26 26 27 -To make this work in eMagiz you need to navigate to the Create phase of eMagiz and open the entry flow in which you want to retrieve the file to a certain location. Within the context of this flow, we need to add functionality that will ensure that each line is read and processed separately and will become its unique message. To do so first enter "Start Editing" mode on flow level. After you have done so please add a file item reader message source to the flow. We will use this component to read and process our input file on a per-line basis. 26 +Crucial parts in the configuration are: 27 +* Operation Name 28 +* SOAP Webservice Namespace 29 +* Validation 30 +* Authentication 28 28 29 - The firststepwould be todefinethedirectoryfromwhichwe readourmessages.Asalwaysreference to thedirectorywiththe helpofa property.32 +Of these four points, we will zoom in on the validation part of our SOAP Webservice in this microlearning. The SOAP Webservice serves as a point of entry where people with the proper credentials (security) and the correct answers (validation) can enter and perform their actions. In the previous microlearning, we talked about the security part. In this microlearning, we talk about the validation part. 30 30 31 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--file-item-reader-directory.png]]34 +=== 3.1 Configuration on system message level in Design === 32 32 33 - Secondly,just as when readingthefile as a whole ensure that you use afilter to retrieve onlythecorrectfilesfrom thedirectory.36 +As you have learned from the crash course, you can validate an XML message with the help of an XSD. This XSD describes data types, order, associations, and length of attributes. You can use such an XSD to validate what your clients send you. eMagiz will automatically define a WSDL based on the combination of system messages you provide for each operation you want to host. To ensure that the WSDL is created correctly, don't forget to add an entity called "Send{givenname}Request" to the (request) system message and an entity called "Send{givenname}Response" in case you have a response system message. An example of how this needs to be configured in Design is shown below. 34 34 35 - === 3.1ItemType ===38 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages-gen3--root-entity-for-wsdl.png]] 36 36 37 - Nowit is time to select our Item reader Type.As the help text ofthe eMagiz component suggest there are two choices with this component. Thefirst (and most frequently used) option is the Flat file item reader. With this option, youcan read each line withinthe flat file inputfile and output is at a separatemessage. The second option is calledthe Stax event item reader. With this option, you can read your input XML and output messages on a per-record basis.40 +=== 3.2 Effect in Create === 38 38 39 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--item-reader-type-options.png]]42 +In the infra flow, eMagiz automatically adds a support object of the "Dynamic WSDL" type. In this support object, the link is made between the system message definitions and the WSDL that will be created based on this. 40 40 41 - Based onyourchoicethexactconfigurationwilldiffer.44 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages-gen3--dynamic-wsdl-support-object-infra.png]] 42 42 43 - ====3.1.1 StaxEventItemReader====46 +{{warning}}Note that when you make changes to the system message after the integration is already in Create, or when you add a new integration to Create, you need to create a new version of your infra flow to be able to deploy the changes to your WSDL.{{/warning}} 44 44 45 - FortheStaxeventitemreader, youneedtodefinethenameof the elementon whichyouwantlittheXMLanddefinewhetheryouwanttothrowanerrorincase nosuchelement existsintheinputfile(By (de)selectingthe optionStrict). ThedefaultsettingofeMagiz is advisableforthision.48 +In this same support object, you also see the default location of the hosted SOAP endpoint, which is http://localhost:${entry.connector.ws.port}/ws/{soap WS name}/. Based on this, you can find the WSDL by adding {soap WS name}.wsdl to the URI. In this example, when hosting the SOAP web service on-premise, a valid URI would be "http://localhost:8099/ws/soapgn3-connector/soapgn3-connector.wsdl". 46 46 47 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--stax-event-item-reader-config.png]]50 +{{info}}Note that when running your web service in the eMagiz cloud, the first part (the host part) will change depending on your configuration in Deploy Architecture and the cloud slot on which you are running. An example URI, in that case, would be "https://soap-test-cloud0000.emagizcloud.com/ws/soapgn3-connector/soapgn3-connector.wsdl"{{/info}} 48 48 49 - ==== 3.1.2 FlatFileItemReader====52 +With this done, you have successfully added validation to your SOAP web service. 50 50 51 -For the Flat File item reader, there are some more choices and configurations to be made. There are three options you can choose from: 52 -- Pass through line mapper 53 -- Default line mapper 54 -- Pattern matching composite line mapper 55 - 56 -Each of these options has some advantages and disadvantages. Adhering to the best practices of eMagiz (i.e. no transformation in the entry) the best option would be to use the pass-through line mapper. As the name suggests this option does nothing except give a string back to the flow on a per line basis. However, choosing this option means that the actual transformation from that string to XML needs to happen later in the process (most likely in the onramp) with the help of a flat-file to XML transformer (more on that component in a later course). 57 - 58 -The other two options transform the input line into an XML output. So you win one step in the process. However, no standard eMagiz error handling is advisable when you start transforming data within the entry. So in case, something goes wrong to analyze the error will become more difficult. Furthermore, another potential disadvantage is that when one line fails the processing of the rest of the file also halts. 59 - 60 -For the remainder of this microlearning, we will assume that the option pass through line mapper is chosen. 61 - 62 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough.png]] 63 - 64 -As you can see on the Basic level we are done. However, it is always good to check out the settings on the Advanced tab, especially in this case, to see if there are additional configuration options that could benefit us. The setting of most interest, in this case, is the Lines to Skip setting (default setting is 0). With this setting, you can define whether or not you want to process the header line(s) that exists within your input file. The remainder of the settings is (in most cases) good the way eMagiz has set them up. 65 - 66 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough-advanced.png]] 67 - 68 -=== 3.2 Poller === 69 - 70 -Now that we have selected and configured the item reader type it becomes time to fill in the last part of the configuration, the poller. For polling eMagiz offers three options: 71 - 72 -- Fixed Delay Trigger 73 -- Fixed Rate Trigger 74 -- Cron Trigger 75 - 76 -Of these options, the cron trigger is used most frequently in eMagiz. The reason being is that you can define this option via a property that you can alter without having to alter the flow version in Create. 77 - 78 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--poller-config.png]] 79 - 80 -After finishing all these configuration steps we can press Save to save our work and ensure that we can process the input file on a per-line basis. 81 - 82 82 == 4. Assignment == 83 83 84 - Configurean entryinwhichyoudefinethecomponentandconfigurationneeded to process a file on a per-line basis.85 -This assignment can be completed with the help of the (Academy) project thatyouhavecreated/used in the previous assignment.56 +Add validation to the SOAP Webservice we have been configuring. 57 +This assignment can be completed with the help of the (Academy) project you created/used in the previous assignment. 86 86 87 87 == 5. Key takeaways == 88 88 89 -* Easy way of reading a file line by line and sending it to eMagiz (Low on memory) 90 -* Ability to process each line based on distinctive logic that is relevant on line level 91 -* Can be used for flat file as well as XML input files 92 -* Try to avoid complex transformations within the entry 61 +* Crucial parts in the configuration are: 62 + ** Operation Name 63 + ** SOAP Webservice Namespace 64 + ** validationvalidation 65 + ** Authentication 66 +* Validation is done with the help of an XSD 67 +* The WSDL is used for external documentation 68 +* eMagiz will automatically generate the WSDL for you based on your system messages 69 +** Do not forget to add the correct root entity to your system message to make the WSDL work 93 93 94 94 == 6. Suggested Additional Readings == 95 95 96 - Thereare no suggestedadditionalreadingsonthistopic73 +If you are interested in this topic and want more information, please read the help text provided by eMagiz. 97 97 98 98 == 7. Silent demonstration video == 99 99 100 - Thisvideodemonstrateshowyoucould havehandledheassignment andgivesyousomecontext onwhat you havejustlearned.77 +{{video attachment="novice-soap-webservice-connectivity-validate-incoming-messages-gen3.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 101 101 102 -{{video attachment="novice-file-based-connectivity-processing-a-file-per-line.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 103 - 104 104 )))((({{toc/}}))){{/container}}{{/container}}