cancel
Showing results for 
Search instead for 
Did you mean: 

XML validation check and error handling - in 7.31 PO

Former Member
0 Kudos

Hi,

I have a scenario in my project where the the Source system would be placing an XML file to an FTP server.

The chellange is to first check for the well formedness of the XML file and then validate the XML against the XSD provided.
In case of any error/exception, the error description has to be written to a file as an XML.

We are using 7.31 single stack version.

I tried to follow the blog from Michal,

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/02/15/michals-pi-tips-xml-validation--c...

where, PI 7.31 gives the feature of validating the XML against Schema directly.

But is there any provision for capturing the error and sending it as a file/ mail attachment.

If there is no standard solution to this, please suggest if there is any alternate solution available.

Thanks,
Ashish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

I would suggest to go for a standard solution means use PO - XML validation feature + register a consumer for your interface (using register** API) and query the alerts for your interface using Alert Retrieve API. You can use below approach for querying the alert and creating a file/or mail with the error description.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/10/23/customize-e-mail-body-and-subject...

Thanks

Amit Srivastava

Former Member
0 Kudos

Thanks a lot Amit.

the blog seems to be very handy for my scenario to write the error details to a file.

Just for my clarity, could you please let me know its impact on the performance. i.e Can we use this solution for a high volume of messages?

Also, can we use this solution for just a specific interface only?

Thnaks,

Ashish

Former Member
0 Kudos

Hello,

I had designed a very similar kind of solution in my previous project (in PO system), but in my case the sender system is querying the standard API once a day to see if there is any error occurred in the system for a specific interface. So i just provided the standard endpoint URL to sender system (no development required) and they consume the alerts generated in PO system...

>>Just for my clarity, could you please let me know its impact on the performance. i.e Can we use this solution for a high volume of messages?

Also, can we use this solution for just a specific interface only?

Now coming to your question, personally i prefer to use standard alerting framework + Solman (in my current project i am using the same) for tracing/notification of error events so IMO i would suggest that don't use this kind of solution for all interfaces....but if u want to build this solution for a specific interface then it will work but obviously some downsides may occur for high volume messages.

So ultimately the choice is yours

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

Thanks for the above info. I had one more query on this solution.

How are we going to trigger the standard Webservice Interface?

Do we need to schedule the File sender channel ? Means, how it would come to know that an error has occurred and start the File sender ?

Thanks,

Ashish

Answers (2)

Answers (2)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>But is there any provision for capturing the error and sending it as a file/ mail attachment.

If there is no standard solution to this, please suggest if there is any alternate solution available.

You can write a java class that uses jdom or dom4j parser and validate the xml against xsd first and if there is any error, it will create the exception log and paste it  on the first few lines of the xml file and rename the file as filename_error.xml and ftp or email them. You can set cron job in unix box to run this java class at a specified interval of time. All this can be achieved using java programming. This is an alternate approach basically creating custom application. Search google for parsing the xml file as well sending email. You will see plenty of documents.

Former Member
0 Kudos

Hi Ashish,

Please check this link:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/09/michals-popi-tips-audit-logs-from...

You can read audit log entries using a web service and build custom application to send an email.

Regards,

Beena

Former Member
0 Kudos

Note 1486734 - Problems Using AdapterMessageMonitoringVi

Please check this note also.

You may try alerts.

Former Member
0 Kudos

Hi Beena,

Thanks a lot for the update. As you have mentioned that using the custom web service, we can fetch the audit logs and send as an email. But can we automate this process without manual interventions?

My requirement is to write the schema validation error logs to a file in FTP server. Also, the note mentions that it is not recommended to be used by external application.

Please let me know if any alternate solution available.

Thanks,

Ashish