Changes for page Validate Incoming Messages
Last modified by Erik Bakker on 2024/08/26 12:39
From version 43.1
edited by Erik Bakker
on 2022/12/30 12:06
on 2022/12/30 12:06
Change comment:
There is no comment for this version
To version 42.2
edited by Erik Bakker
on 2022/12/30 11:48
on 2022/12/30 11:48
Change comment:
Update document after refactoring.
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - ValidateIncomingMessages1 +novice-soap-webservice-connectivity-validate-incoming-messages-gen3 - Content
-
... ... @@ -29,26 +29,71 @@ 29 29 * Validation 30 30 * Authentication 31 31 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 rights credentials (security) and the right answers (validation) are allowed to enter and perform their actions. In the previousmicrolearning, we talkedabout the security part. In this microlearning, we talk about the validation part.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 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. 33 33 34 - ===3.1Configuration on systemmessage level inDesign===34 +As you have learned from the crash course you can validate an XML message with the help of an XSD. This XSD describes dataTypes, order, associations, and length of attributes. You can use such an XSD for the validation of what your clients send you. eMagiz will automatically define a WSDL based on the XSD that you provide that stores metainformation and stores the XSD for validation purposes. This way you can communicate the WSDL (location) to external parties as a reference document upon which they can build their solution. If you keep the eMagiz defaults you can access the WSDL via "http:~//localhost:port/ws/ws-name/ws-name.wsdl". Note that you need to replace all values (except for the ws and .wsdl part) with actual values. 35 35 36 - As youhavelearned from the crash courseyoucanvalidate an XML message with the helpof anXSD.ThisXSDdescribes dataTypes, order, associations, and lengthof attributes.Youcan use suchanXSD forthevalidationof whatyour clients send you. eMagizwillautomaticallydefineWSDLbased on thecombination ofsystem messagethatyouprovide foreachoperation youwanttohost.Toensure that theWSDLiscreated correctlydon'tforget toadd an entity called"Send{givenname}Request"tothe(request)systemmessageandanentitycalled "Send{givenname}Response"in caseyouhave a responsesystemmessage. An example ofhow thisneedstobe configuredinDesignis shownbelow.36 +What eMagiz does need from you is the correct XSD for validation. As a starting point you should download the XSD that eMagiz has generated based on the system message(s) you have defined in the Design phase. Once you have that you can structure the XSD correctly. A valid XSD start with a schema segment. In this segment you need to define your SOAP WS namespace: 37 37 38 -[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages-gen3--root-entity-for-wsdl.png]] 38 +{{code language="xml"}} 39 +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 40 +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 41 + xmlns="http://www.academy.emagiz.com/ns/mlacade-bus/spwbsrv-connector/1.0/" 42 + attributeFormDefault="unqualified" elementFormDefault="unqualified" 43 + targetNamespace="http://www.academy.emagiz.com/ns/mlacade-bus/spwbsrv-connector/1.0/"> 44 +{{/code}} 39 39 40 - ===3.2Effect inCreate===46 +Once you have that you need to copy all complex and simple types from the XSD that you downloaded and paste them below the lines you have created: 41 41 42 -In the infra flow eMagiz automatically adds a support object of the type "Dynamic WSDL". In this support object the link is made between the system message definitions and the WSDL that will be created on the basis of this. 48 +{{code language="xml"}} 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> 73 +{{/code}} 43 43 44 - [[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages-gen3--dynamic-wsdl-support-object-infra.png]]75 +To wrap things up you need to define your Request and Response element and close the schema: 45 45 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}} 77 +{{code language="xml"}} 78 +<xs:element name="SendNptRequest"> 79 + <xs:complexType> 80 + <xs:sequence> 81 + <xs:element name="Input" type="Input"/> 82 + </xs:sequence> 83 + </xs:complexType> 84 + </xs:element> 85 + <xs:element name="SendNptResponse"> 86 + <xs:complexType/> 87 + </xs:element> 88 + </xs:schema> 89 +{{/code}} 47 47 48 - In thissamesupportobjectyoualsoseethedefaultlocation ofthe hostedSOAP endpoint,whichishttp://localhost:${entry.connector.ws.port}/ws/{soapWS name}/.Basedon thisyoucan findtheWSDLby adding {soap WS name}.wsdltotheURI.Inthis example,whenhostingthe SOAPweberviceon-premise,avalidURIwouldbe"http://localhost:8099/ws/soapgn3-connector/soapgn3-connector.wsdl".91 +Combining this will result in a valid XSD for my example. In your case, you will need to enter other values. When you are done with the creation of the XSD save it with a name such as spwbsrv-connector.xsd and upload it to the flow. After you have uploaded the XSD link it to the connector-xsd support object in your entry. 49 49 50 - {{info}}Note that when runningyour webservicetheMagizcloud thefirst part (thehost part) willchangedepending on yourconfigurationin Deploy Architectureand the cloudsloton which you are running. An exampleURI in that case would be "https://soap-test-cloud0000.emagizcloud.com/ws/soapgn3-connector/soapgn3-connector.wsdl"{{/info}}93 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--uploaded-file.png]] 51 51 95 +[[image:Main.Images.Microlearning.WebHome@novice-soap-webservice-connectivity-validate-incoming-messages--file-linked-to-xsd-component.png]] 96 + 52 52 With this done you have successfully added validation to your SOAP web service. 53 53 54 54 == 4. Assignment == ... ... @@ -65,8 +65,7 @@ 65 65 ** Authentication 66 66 * Validation is done with the help of an XSD 67 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 113 +* Use the XSD generated by eMagiz based on the system message as a starting point 70 70 71 71 == 6. Suggested Additional Readings == 72 72