In PI 7.1 validation functionality is available, so now with the help of PI 7.1 we can validate our incoming and outgoing messages in IE as well as in AAE corresponding to their structure i.e. XSD or DTD. This article describes XML Validation in the IE. In my next article, I will demonstrate how we can validate XML messages and message header in AAE.
There are couple of presentations on SDN, that’s tell about validation functionality in PI 7.1, but this article is posted in order to demonstrate the steps which are required to achieve it practically.
When we talk about XML validation in IE, then our incoming messages are validated corresponding to their schemas that are stored in File system. In PI 7.1 new Pipeline steps are introduced (“XML Validation Inbound Channel Request” and “XML Validation Outbound Channel Request”) to achieve validation.
If validation fails (Inbound side or Outbound side), then message processing will be stopped. Example, if we validate our incoming messages in IE and if invalid XML entered in IE then processing will fails in second step i.e XML Validation Inbound Channel Request”. In previous versions these messages fails in “Request Messaging Mapping” step.
So if validation fails in IE, Error description will be visible in MONI. It gives detailed error description and all structure errors information’s.
Important: If validation performed in IE, then sender will not get information about the failed structures. Administrator will look on these messages and can take further actions. In case of validation in AAE, adapter can send the error message to the sender.
“Fault Messages, Receipt Acknowledgement, Exceptions are not validated”.
Following steps demonstrate how we achieve the incoming XML validation in IE.
1. Design your objects in the ESR.
2. Configure your objects in the ID.
3. Required to validate incoming messages by IE, so check the option “Validation by Integration Engine” in Sender Agreement.
4. Create appropriate directory structure where we have to save our structure (xsd).
usrsap<system id>SYSglobalxiruntime_server<A><B><C><D><E><F>
A – validation
B – schema
C – GUID of the SWCV where service interface reside.
D – Repository Namespace where Service Interface is created.
E – Service Interface Name
F – Repository Namespace where Message Type or External Definition is assigned.
Note: if your ESR namespace contains special character then do replace it with “~” in folder name.
If namespace is http://farooq.com/XI/FileToFile
then folder name should be
http~farooq.com~XI~FileToFile
Export schema from the ESR and save it in folder “F” with name <<RootElementOfMessageType>>.xsd
. So in this case it is MT_File_Sender.xsd
5. Testing of the Scenario.
In this example, all designed values for source MT are mandatory. What happen if ZIP tag is missing in sender message or payload.
In XML document ZIP is missing
Message fail in IE and message processing stopped. The Error description is appropriate for the administrators.
Similarly we can validate outgoing messages in IE by selecting an option “Validation by Integration Engine” in Receiver Agreement.
Farooq Farooqui is an SAP NetWeaver PI Consultant with Cognizant, India. He holds SAP PI Certification and has previously worked with majors like Accenture and Atos Origin.