cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP to File with source XML validation

Former Member
0 Kudos

Hey guys

i have a HTTP to File scenario wherein i m getting XML over HTTP from an external system.i need to perform a validation check on this payload and if the check fails then i need to send this payload as a mail attachment to a certain address,if check is successful then i need to post this XML to the File server.

i have done simple scenario without any validation but now i need to upgrade and perform validations,do i need to do that in Message mappin?

some links will be really helpful

thanx

ahmad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ahmad,

In receiver determination you configure two receivers and use the conditions:

a) if condition is satisfied write the file

b) if the condition is not satisfied then send the mail.

Also check this weblogs for some help:

/people/prasadbabu.nemalikanti3/blog/2006/09/20/receiver-determination-based-on-the-payload-of-input-dataextended-xpathcontext-object

/people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16

/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers

For file validations check this:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=...ValidationsinSAPXI-ACaseStudy.pdf

/people/dmitry.govberg/blog/2007/02/12/informing-the-sender-about-bad-records

---Satish

Former Member
0 Kudos

Thanx guys

so do i need to use Multimapping or i will create two separate mappings,one for each interface?

thanx

ahmad

henrique_pinto
Active Contributor
0 Kudos

what kind of validation are you refering to?

Value validation (on which you'll probably have to acces some database to check that) or simple XML Schema validation?

Anyway, you should use one single mapping program. This mapping should not change the payload, just perform a validation check (thus, input and output interfaces should be the same). You can even use the same mapping interface you are using in the not-validating scenario and just add the mapping program to that interface.

For Schema validation, you'll have to use Java Mapping. For value validation, you could use message mappings, in the fields that you need to validate.

Regards,

Henrique.

Former Member
0 Kudos

Hey

suppose i have a source structure of the following form

<Emp>

<Emp_id> 001</Emp_id>

<Emp_age>28</Emp_age>

</Emp>

now wat i want is that if the Value of Emp_id is Greater that 005 then it should be treated as valid and must be mapped to the receiver file adapter,but if the value is less that 005 then its invalid and the payload must be send as an attachment to the Admin.

now here,wont i need two message mappings,one for HTTP to File and other for HTTP to Mail?

thanx

ahmad

Message was edited by:

Ahmad

henrique_pinto
Active Contributor
0 Kudos

Hey dude,

If it is as simple as that, and will remain that simple, you could do that in simple Receiver Determination condition (not recommended tho).

Go for file validation as the guys have already said.

As for the mail mapping, you wont need any mapping (you could send the file without any mapping), if it is always the same mail receiver (you could separate it by sender system: one mail receiver for each sender system), if you dont mind using the same interface. If you do need to use another one, you'll need a specific mapping.

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Ahmad,

Like pointed by Henrique, use Conditonal Receiver Determination.

in the conditin editor for the Receievr Determination your can give the conditon as per your requriement over which the receievr will be choosen.

Also as pointed for file you will have one mapping and if the requirement is to send the entire HTTP content as Email, then you do not need a mapping. Just make sure that the Corresponding Inbond interface for the mail uses the same message type as http.

Regards

Bhavesh

Former Member
0 Kudos

Hi,

I hope the following two ways are possible.

1)

Maintain one message as source and two messages as target.One is actual message and second one message structure should containt the structure with error details with source details.

Validate the message in MM with UDF.

If the source is valid then assign the msg to correct target messages.and ResultList.SUPPRESS to suppress the second message

Else then assign the error details with source details to second message.and ResultList.SUPPRESS to suppress the first message

Be sure that the target messages occurrences are 0..unbound or 0..1

then use the IM in interface determination.

and maitain two CCs one for actual receiver, second for MAIL receiver with HTTP attatchment.

2) You can raise an alert from payload. in alert you should maitain the mail, su01 mail id , designated reciept.

See the below links

Alerts with variables from the messages payload (XI) - UPDATED - /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated

Triggering XI Alerts from a User Defined Function - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function

/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address - Dynamic Mail Address

/people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u - Triggering Email from folder

/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter - XI: HTML e-mails from the receiver mail adapter

Regards

Chilla

Former Member
0 Kudos

Hey guys

thanx for ur replies.

well the way i have designed this scenario is something like this,please let me know if my design is correct so that i can start working on it

DT_sender(for Sender HTTP)

DT_Recv_File(for File receiver)

DT_Recv_Mail(for Mail receiver)

and then message types and message interfaces for all the above three.

as i need to send the whole payload in mail i guess i dont need any mapping,right?so i create only one mapping for the valid file

MM_HTTP_File and then the interface mapping for this mapping.

in ID,everything will be same as a normal HTTP to File scenario,only difference will be that i would go for conditional receiver determination and specify two conditions and based upon that i will provide two different business systems and route my messages.

lemme know if my design sounds good to u guys

thanx

ahmad

Former Member
0 Kudos

HI,

Yes your design looks good.

Did yu got success??

See my above answer , how to maitain it , it may helps you

Regards

Chilla

<i>reward points if it is helpful..</i>

Former Member
0 Kudos

yeah Chilla

ur replies always helps me:) i m gonna start working on this scenario hopefully today and will get back to you guys if i m stuck.

i m taking help from some links you and other guys send me and hopefully i shud be ok

thanx

ahmad

henrique_pinto
Active Contributor
0 Kudos

You dont need to create different data types, message types and message interfaces for File and Mail.

Create a single DT_Recv and create objects from it.

Or you could even use the same data and message types from http, if it doesnt change.

You will only have to create different interfaces, since sender is Outbound and receiver is Inbound.

Regards,

Henrique.

Former Member
0 Kudos

Thanx Pinto

yeah i m doing the same thing.

thanx

ahmad

Answers (1)

Answers (1)

Former Member
0 Kudos

then use enchanced receiver determination by using it you slove it easliy