Validations using Java for those not having PI7.1
Message validations in XI has always been a matter of concern for developers. Especially for those who are even refrained from using BPM’s. I always wondered so as to why the ‘Details’ part is provided in the data type creation? As there is no check on the incoming message based on these details! Even though you provide the ‘Details’ say like ‘maxLength=8′ the XI will still accept the data which exceeds this ‘maxLength’ there was no API which can stop this from happening. But for those who want this functionality they have two options: ** Stay on the current version of XI and find a way out. Well here is one of the way outs: Using a validation program in Java Mapping.
*Step1:*Mention the Details about the fields in the DT(Data Type)
*Step2:*Export the XSD(Schema) of the MT(Message type) created using this DT and place it at a location in server 
*Step1:*Mention the Details about the fields in the DT(Data Type)
*Step2:*Export the XSD(Schema) of the MT(Message type) created using this DT and place it at a location in server 
And there sems to be no way to stop the SAP from throwing an exception and read/collect more errors and then give up.
For this there is only one way to handle and that is designing our own parser and handling the exceptions thrown by it.
Regards,
Henrique.
Yes you are right, it is not SAP's limitation its the parsers that have a limit.
Lets consider this case:
there is one message containing say 10 records and one field in all the records is vulnerable to errors.
Now whenever this message is processed thru the mapping logic it will throw an exception mentioning only the first occurence of the error- in short it will show me the error in the field in the record which comes first in all the 10 records.Of course it is implicite to check all the such vulnerable fields for correction but this is an option for suitable for only few records-consider the case for huge data.
So it is always helpful to throw an exception which clearly says that "Fieldxx of Record xxx has xxx error".
All this if would have been possible to do-then I think I would be writing some code before the Exception is thrown and in that I would have collected the list of such possible errors.
Well to my question the answer from SAP is a simple No!
So in all even though there is an option of generating an alert for an exception(which is not very detailed one) we fall short of resource.
Well this is apart from our discussion to the above blog.
Concerned to the above blog let me write one more which will remove this "Shortfall".(of course it will have my own parsing technique so please bear with the performance 🙂 )
very helpful blog.
Regards,
Rao.Mallikarjuna
I am trying to achieve XSD validation in SAP PI 7.1.1 and got your blog as a reference. If possible can you please help me understanding the concept? You can post your replies in this thread:
XML Validation against XSD and ACK Message
Thank you,
Pankaj