cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement validations in message mapping?

Former Member
0 Kudos

Hi experts,

I have a simple requirement:

I have a simple synchronous scenario:

SOAP -> XI -> RFC

In a message mapping, one of the fields in the source message is of type String.

However, the target application (RFC) does not expect a non-numeric characters in this string.

My question is how can I perform the validation in XI and tell the sender that this field contains Non-numeric characters?

Please help.

Thanks.

Ron

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You need to use User defined function.

You can use regular expressions inside it:

/people/wojciech.gasiorowski/blog/2006/11/01/the-power-of-regular-expressions-in-graphical-mapping-xi

Regards,

Wojciech

Former Member
0 Kudos

> Hi,

> You need to use User defined function.

>

> Regards,

> Wojciech

Can you give more details please?

How can using a UDF help in this case?

Thanks.

Ron

Former Member
0 Kudos

Hi,

You are filtering each target field via UDF. In case if something doesn't fulfill your requirements you are throwing RuntimeError.

Regards,

Wojciech

Former Member
0 Kudos

For instance you can use something like that:

[code]

import: java.util.regex.*;

if(Pattern.matches("^[0-9]*$", a))

return a;

else

throw new RuntimeException("Error in field XXX");[/code]

Regards,

Wojciech

Former Member
0 Kudos

With a RunTime Exception thrown, how can I tell the sender an error has occured?

Can we send a reply message (using the response message mapping) and inform them a validation error has occured?

I'm not using BPM.

If this can be done, please teach me how to do it.

Thanks.

Ron

Former Member
0 Kudos

Ron,

>>With a RunTime Exception thrown, how can I tell the sender an error has occured?

Sure. You can do this with out a BPM. You need to configure alerts for this. If you configure ALERTS and SCOTT, this will send an email of the errors occuring in your scenario.

For configuring and trouble shooting alerts check these

/people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide

/people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step

Regards,

Jai Shankar

Former Member
0 Kudos

> Ron,

>

> >>With a RunTime Exception thrown, how can I tell

> the sender an error has occured?

>

> Sure. You can do this with out a BPM. You need to

> configure alerts for this. If you configure ALERTS

> and SCOTT, this will send an email of the errors

> occuring in your scenario.

>

> For configuring and trouble shooting alerts check

> these

>

> https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/

> 2327

> https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/

> 2328

>

> Regards,

> Jai Shankar

Hi Jai

I already have alerts configured.

But what I had in mind is to send a response to the sender (The sender is waiting for a reply since this is synchronous), instead of telling the sender through an alternative means such as email, sms, etc.

Is this possible?

bhavesh_kantilal
Active Contributor
0 Kudos

Ron,

You will need to use a BPM in this case. Validate thew request , and then over a switch decide if the message is to be sent to the actual RFC or back to the SOAP as an error message.

regards

Bhavesh

Former Member
0 Kudos

Hi Ron,

What is your target system? If uoi are using server proxies, then you can avoid BPM by using Fault message types in your scenario. But this will not send a msg incase of mapping failure. This will send an error msg back to sender only if the request msg reaches the target system and some error occur during the processing in target system.

For other scenarios you have to follow Bhavesh's reply.

Regards,

Jai Shankar