Changes for page SOAP Headers
Last modified by Erik Bakker on 2024/08/26 12:48
From version 36.1
edited by Erik Bakker
on 2022/06/12 09:36
on 2022/06/12 09:36
Change comment:
There is no comment for this version
To version 40.1
edited by Erik Bakker
on 2022/08/22 15:56
on 2022/08/22 15:56
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - ValidateIncoming Messages1 +SOAP Headers - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,113 +1,59 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 -When settingup a pointatwhichyour customerscan talktoyou eMagizoffers various methods of creatingsuchpoint. One of thoseoptionsis by hostingaSOAP Webservicein eMagizthat handlesXMLmessagesasynchronouslyorsynchronously. In this microlearning, we willzoom in onthepartthatvalidationofthemessagesplayswhen offeringsucha SOAPweb service.2 +When communicating via SOAP web service calls it can happen that an exchange of data needs to happen between the message headers on your message and the SOAP headers. In this microlearning, we will learn about this exchange in both directions. SOAP Headers are headers within a SOAP Envelope that can be used to communicate metadata or authentication information between parties. 3 3 4 4 Should you have any questions, please contact academy@emagiz.com. 5 5 6 -* Last update: June 10th, 2021 7 -* Required reading time: 7 minutes 8 - 9 9 == 1. Prerequisites == 10 10 * Basic knowledge of the eMagiz platform 11 11 12 12 == 2. Key concepts == 13 -This microlearning centers around configuring yourSOAPweb service.10 +This microlearning centers around SOAP Headers. 14 14 15 -By configuring, we mean:DesigninganddeterminingthecharacteristicsoftheSOAPweb service12 +By SOAP Headers, we mean: headers within a SOAP Envelope that can be used to communicate metadata or authentication information between parties 16 16 17 -Crucial parts in the configuration are: 18 -* Operation Name 19 -* SOAP Webservice Namespace 20 -* Validation 21 -* Authentication 14 +You can exchange data from: 15 +* SOAP Header to Message Header 16 +* Message Header to SOAP Header 22 22 23 -Of these four points, we will zoom in on the validation part of our SOAP Webservice in this microlearning. 24 - 25 -== 3. Validate Incoming Messages == 18 +In both cases ensure that the correct information is exchanged. 26 26 27 - Whensetting 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 by hosting aSOAPWebservice in eMagiz that handles XML messages asynchronouslyor synchronously. In this microlearning, we will zoom in on the part that validation of the messages plays when offering such a SOAP web service.20 +== 3. SOAP Headers == 28 28 29 -Crucial parts in the configuration are: 30 -* Operation Name 31 -* SOAP Webservice Namespace 32 -* Validation 33 -* Authentication 22 +When communicating via SOAP web service calls it can happen that an exchange of data needs to happen between the message headers on your message and the SOAP headers. In this microlearning, we will learn about this exchange in both directions. SOAP Headers are headers within a SOAP Envelope that can be used to communicate metadata or authentication information between parties. 34 34 35 -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 rights credentials (security) and the right answers (validation) are allowed to enter and perform their actions. In the next microlearning, we will talk about the security part. In this microlearning, we talk about the validation part. 24 +You can exchange data from: 25 +* SOAP Header to Message Header 26 +* Message Header to SOAP Header 36 36 37 - As you have learnedfromthecrash courseyou can validate an XML messagewith thehelp of anXSD. ThisXSD describesdataTypes, order, associations,and lengthof attributes.Youcan use such an XSD forthe validation of what yourclients send you. eMagiz will automatically define a WSDL based ontheXSD that you provide that stores metainformationand stores the XSD for validation purposes.This way you can communicatethe WSDL (location) to external parties as a reference document upon which they canbuild their solution. If you keep the eMagiz defaults you can access the WSDL via http://host:port/ws/ws-name/ws-name.wsdl.Note that you need to all values (except for the ws and .wsdl part) with actual values.28 +In both cases ensure that the correct information is exchanged. 38 38 39 - WhateMagiz does needfromyouisthecorrectXSD forvalidation. As astartingpointyou shoulddownload theXSD that eMagizhas generatedbasedonthesystem message(s) you havedefinedintheDesignphase.Onceyouhavethatyou canstructure theXSD correctly.AvalidXSD startwitha schemasegment.In thissegmentyouneedtofineyourSOAPWSnamespace:30 +In a previous microlearning, we already discussed one aspect of this. As you probably recall from our microlearning on [[Securing your SOAP Webservice>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-web service-connectivity-securing-your-soap-webservice.WebHome||target="blank"]] we needed to exchange data between the SOAP header that our client was sending and a message header on the message so we could check whether or not the client was authorized to call the operation. 40 40 41 -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 42 -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 43 - xmlns="http://www.academy.emagiz.com/ns/mlacade-bus/spwbsrv-connector/1.0/" 44 - attributeFormDefault="unqualified" elementFormDefault="unqualified" 45 - targetNamespace="http://www.academy.emagiz.com/ns/mlacade-bus/spwbsrv-connector/1.0/"> 32 +In that microlearning, we also discussed the component that we need for this. The 'complex SOAP header mapper'. 46 46 47 - Once you havethat youneed tocopy all complexand simpletypesfrom theXSDthatu downloadedandpastethembelow thelinesyouhavecreated:34 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-soap-headers--complex-soap-header-mapper.png]] 48 48 49 -<xs:complexType name="Input"> 50 - <xs:sequence> 51 - <xs:element name="String" type="nonEmptyString"/> 52 - <xs:element minOccurs="0" name="Decimal" type="xs:decimal"/> 53 - <xs:element name="Enum" type="Enum"/> 54 - <xs:element name="Integer" type="xs:long"/> 55 - <xs:element name="Boolean" type="xs:boolean"/> 56 - <xs:element minOccurs="0" name="DateTime" type="xs:dateTime"/> 57 - </xs:sequence> 58 - </xs:complexType> 59 - <xs:simpleType name="nonEmptyString"> 60 - <xs:restriction base="xs:string"> 61 - <xs:minLength value="1"/> 62 - </xs:restriction> 63 - </xs:simpleType> 64 - <xs:simpleType name="Enum"> 65 - <xs:restriction base="xs:string"> 66 - <xs:enumeration value="URGENT"/> 67 - <xs:enumeration value="HIGH"/> 68 - <xs:enumeration value="MEDIUM"/> 69 - <xs:enumeration value="LOW"/> 70 - <xs:enumeration value="PLANNING"/> 71 - </xs:restriction> 72 - </xs:simpleType> 36 +As you can see you can map from and to message headers with regards to the SOAP Headers. As we already discussed the first scenario in an earlier microlearning I will for now continue with the other scenario. This scenario is mainly needed when eMagiz calls a SOAP web service that is hosted by an external party. Since we would normally do this in an exit (gate/flow) let us open such an exit in eMagiz and enter "Start Editing" mode. 73 73 74 -To wrap thin gsupyouneed to defineyourRequest andResponse element andclose the schema:38 +The first step we need to take is to ensure that the information that we need to send to the SOAP web service in question (in this a unique reference number) is available in a message header. This can be done by verifying in all steps that preceded before the message entered the exit whether or not this piece of information was already added to a message header. In this case, we assume that this is the case since we want to focus on the 'complex SOAP header mapper' component and its relation to the web services outbound gateway. To correctly exchange data from a message header to a SOAP header we need to define a valid SpEL expression. See the help text of the component for a suggestion of what a valid SpEL expression is. The key part in this is knowing how the external party wants to receive the header(s) and how you (or one of your colleagues) has named the message header. When you have those two information elements you can write the correct expression. The result should be something as follows: 75 75 76 -<xs:element name="SendNptRequest"> 77 - <xs:complexType> 78 - <xs:sequence> 79 - <xs:element name="Input" type="Input"/> 80 - </xs:sequence> 81 - </xs:complexType> 82 - </xs:element> 83 - <xs:element name="SendNptResponse"> 84 - <xs:complexType/> 85 - </xs:element> 86 - </xs:schema> 40 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-soap-headers--mapping-from-message-header.png]] 87 87 88 - Combining this will result in a valid XSD for my example. In yourcase,youwill need to enterothervalues. Whenyou are donewith the creationof the XSD saveitwitha name such as spwbsrv-connector.xsdand upload itto theflow.Afteryou have uploaded the XSD link it to theconnector-xsdsupportobject in your entry.42 +Once you are satisfied you can press Save and link the support object to the web service outbound gateway. 89 89 90 - [[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--uploaded-file.png]]44 +With this information, you can place SOAP Headers on message headers and vice versa every time you need it. 91 91 92 -[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--file-linked-to-xsd-component.png]] 93 - 94 -With this done you have successfully added validation to your SOAP web service. 95 - 96 96 == 4. Assignment == 97 97 98 - Add validation to theSOAP Webservicewe havebeenconfiguring.48 +Call an external web service and send along some SOAP Headers. 99 99 This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment. 100 100 101 101 == 5. Key takeaways == 102 102 103 -* Crucial parts in the configuration are: 104 - ** Operation Name 105 - ** SOAP Webservice Namespace 106 - ** Validation 107 - ** Authentication 108 -* Validation is done with the help of an XSD 109 -* The WSDL is used for external documentation 110 -* Use the XSD generated by eMagiz based on the system message as a starting point 53 +* You can exchange data from: 54 + ** SOAP Header to Message Header 55 + ** Message Header to SOAP Header 56 +* You need the SOAP structure and the message header name to make it work 111 111 112 112 == 6. Suggested Additional Readings == 113 113 ... ... @@ -115,6 +115,6 @@ 115 115 116 116 == 7. Silent demonstration video == 117 117 118 -{{video attachment="novice-soap-webservice-connectivity- validate-incoming-messages.mp4" reference="Main.Videos.Microlearning.WebHome"/}}64 +{{video attachment="novice-soap-webservice-connectivity-soap-headers.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 119 119 120 120 )))((({{toc/}}))){{/container}}{{/container}}