Changes for page SOAP Headers
Last modified by Erik Bakker on 2024/08/26 12:48
From version 36.2
edited by Erik Bakker
on 2022/06/12 09:36
on 2022/06/12 09:36
Change comment:
Update document after refactoring.
To version 48.1
edited by Erik Bakker
on 2024/08/26 12:48
on 2024/08/26 12:48
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 - novice-soap-webservice-connectivity-soap-headers1 +SOAP Headers - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,120 +1,70 @@ 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 +You can exchange data from: 23 +* SOAP Header to Message Header 24 +* Message Header to SOAP Header 34 34 35 - Of these four points,we will zoom in onthevalidation part of our SOAP Webservice in thismicrolearning. The SOAP Webserviceserves as a pointof entry where people withtherightscredentials (security)and the right answers (validation) are allowed to enter and performtheiractions.In thenext microlearning, we will talk about the security part. Inthis microlearning, wetalk about the validation part.26 +In both cases ensure that the correct information is exchanged. 36 36 37 - Asyou havelearned from the crashcourse you can validateXML messagewith thehelp ofanXSD. ThisXSD describesdataTypes,order,associations,and lengthofattributes.YoucanusesuchanXSDforthevalidation ofwhatyourclientssendyou.willautomatically definea WSDLbasedontheXSDthatu providethatstoresmetainformationand storesthe XSD forvalidation purposes. This wayyoucan communicatetheWSDL (location) toexternal partiesasa referenceocumentuponwhich theycanbuildheirsolution. If you keepthe eMagizdefaultsyou can accesstheWSDL viahttp://host:port/ws/ws-name/ws-name.wsdl.Notethatyouneedtoallvalues(exceptfor thews and.wsdlpart) withactualvalues.28 +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-webservice-connectivity-securing-your-soap-webservice||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. 38 38 39 - WhateMagiz does need fromyouis thecorrect XSD for validation. As a startingpoint you should download theXSD that eMagiz hasgeneratedbasedonthesystemmessage(s) you have defined inheDesign phase. Once you havethatyoucanstructuretheXSD correctly.A valid XSD start withaschema segment.In this segmentyou needto define yourSOAPWS namespace:30 +In that microlearning, we also discussed the component that we need for this. The 'complex SOAP header mapper'. 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 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-soap-headers--complex-soap-header-mapper.png]] 46 46 47 - Once you have thatyouneed tocopyallcomplexandsimple typesfromtheXSDthatyoudownloaded andpaste thembelowthelinesyou havecreated:34 +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. 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 +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: 73 73 74 - To wrap thingsup youneed todefine your Requestand Responselementand closetheschema:38 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-soap-headers--mapping-from-message-header.png]] 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 +Once you are satisfied you can press Save and link the support object to the web service outbound gateway. 87 87 88 - Combiningthiswill result ina valid XSDfory example. In yourcase,you will needtoenter other values.When you are donewith thecreation of the XSDsaveit witha namesuchas spwbsrv-connector.xsdanduploadit to theflow. Afteryou haveuploaded theXSD link it to the connector-xsdsupportobjectinyourentry.42 +With this information, you can place SOAP Headers on message headers and vice versa every time you need it. 89 89 90 - [[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--uploaded-file.png]]44 +== 4. Key takeaways == 91 91 92 -[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--file-linked-to-xsd-component.png]] 46 +* You can exchange data from: 47 + ** SOAP Header to Message Header 48 + ** Message Header to SOAP Header 49 +* You need the SOAP structure and the message header name to make it work 93 93 94 - Withthisdone youhaveuccessfullyadded validationto your SOAP web service.51 +== 5. Suggested Additional Readings == 95 95 96 -== 4. Assignment == 53 +* [[Crash Course (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.WebHome||target="blank"]] 54 +** [[Crash Course API Gateway (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course API Gateway.WebHome||target="blank"]] 55 +*** [[Setting up Exit gate (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course API Gateway.crashcourse-api-gateway-setting-up-exit-gate||target="blank"]] 56 +* [[Novice (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Novice.WebHome||target="blank"]] 57 +** [[SOAP Web service Connectivity (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.WebHome||target="blank"]] 58 +*** [[Configure your SOAP web service (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-configure-your-soap-webservice-gen3.WebHome||target="blank"]] 59 +*** [[Securing your SOAP Webservice (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-securing-your-soap-webservice||target="blank"]] 60 +*** [[Validate Incoming Messages (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-validate-incoming-messages-gen3.WebHome||target="blank"]] 61 +*** [[Endpoint Check (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-endpoint-check-gen3.WebHome||target="blank"]] 62 +*** [[Calling a SOAP Web service (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-calling-a-soap-webservice||target="blank"]] 63 +*** [[Authorization - Calling a SOAP Webservice (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Novice.SOAP Web service Connectivity.novice-soap-webservice-connectivity-authorization-calling-a-soap-webservice||target="blank"]] 64 +* [[Intermediate (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.WebHome||target="blank"]] 65 +** [[SOAP Web service Connectivity (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.SOAP Web service Connectivity.WebHome||target="blank"]] 66 +* [[Expert (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Expert Level.WebHome||target="blank"]] 67 +** [[Webservice Security (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Expert Level.Webservice Security.WebHome||target="blank"]] 68 +* [[SOAP Headers (Search Result)>>url:https://docs.emagiz.com/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_space_facet=0%2FMain.&f_type=DOCUMENT&f_locale=en&f_locale=&f_locale=en&text=%22soap+headers%22||target="blank"]] 97 97 98 -Add validation to the SOAP Webservice we have been configuring. 99 -This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment. 100 - 101 -== 5. Key takeaways == 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 111 - 112 -== 6. Suggested Additional Readings == 113 - 114 -If you are interested in this topic and want more information on it please read the help text provided by eMagiz. 115 - 116 -== 7. Silent demonstration video == 117 - 118 -{{video attachment="novice-soap-webservice-connectivity-validate-incoming-messages.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 119 - 120 120 )))((({{toc/}}))){{/container}}{{/container}}