cancel
Showing results for 
Search instead for 
Did you mean: 

XML Validation against XSD and ACK Message

Former Member
0 Kudos

Hi,

I have a HTTP -> SAP PI -> IDOC scenario.

HTTP application will send a XML message, now in SAP PI I have to check if this XML message is proper or not (as per the XSD of the message).

If the message is not as per the XSD then SAP PI should respond with a custom XML message to the sending party indicating that the message is not a proper XML (please do not suggest me to configure Alert; I want to provide an ACK and not an alert).

What I think is:

1) I cannot use the XML Validation feature of SAP PI, as it will throw an error and not help me in sending an error-XML message (Acknowledgement) back to the sending party.

2) Using Conditional Receiver Determination, I can check if a node (not) exists/ if a node has required value or not and then call another Service which can send the ACK message back to the Sending Party.

This approach is not feasible in a scenario where I have many fields inside the XML message.

How to proceed on this?

Thank you,

Pankaj.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you might use the following option.

Instead of using the HTTP Adapter, you should use the SOAP Adapter.

You can still use regular HTTP instead of SOAP (just need to specify "No SOAP" in the Communication Channel)

You choose SOAP because then you have the option to check "Validation in the Adapter" in the Sender Agreement.

When the application sends a message by HTTP, the SOAP Adapter will validate the message.

If it is not correct, the sender will get a error reply message saying what is not correct in his message (you can not customize it but the error message already contains details on the type of error)

Best regards,

Markus

Former Member
0 Kudos

Hi,

you can not customize it but the error message already contains details on the type of error

This is the main issue.

The external system(s) have pre-defined format for the acknowledgement and would like to receive the message in that format only.

I will still make a final attempt to convince the business guys to relook into this.

Thank you,

Pankaj.

Former Member
0 Kudos

Hi,

I will try to break the requirement into pieces and try to explain, may be I will get some replies.

I have a HTTP -> PI -> IDOC scenario. PI needs to check if the incoming message is a valid XML message. I thought we can do it using XML Validation (JAVA Mapping).

Assume, the message sent by HTTP application should ideally be:

<Message>
<Field1>SAP</Field1>
<Field2>SDN</Field2>
</Message>

However the HTTP application sends:

<Field1>SAP</Field1>
<Field2>SDN</Field2>

Now PI will, by default, give an error (as the above message is not XML) and also not as per the defined DT in PI.

Will this default error go back to the sender HTTP or will it just stay in PI (in Integration Engine)

Thank you,

Pankaj.

Former Member
0 Kudos

HI,

Any help on this?

Thank you,

Pankaj.

Edited by: Pankaj Sharma XI on Oct 1, 2010 6:39 AM

Former Member
0 Kudos

Hi,

Closing this thread and opening a new one.

Thank you,

Pankaj.

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

you can write a java mapping that will do the validation for you - /people/ranjit.deshmukh/blog/2008/01/14/validations-using-java-for-those-not-having-pi71

then based on a flag that can be incorporated, you can send the required response.

Former Member
0 Kudos

Hi,

I went through the blog, but have some queries:

Step3: Create a xml file u2018SchemaSource.xml' which will contain information about the locations and names of the schemas 
as per their NS (namespaces) as:

What does the above step actually indicate to create? What details should be present in the XML file and from where can i generate the XML file?

Step4: Create an empty logfile on the server at a particular location (in this case it is "dataValidation.log").

Same doubt as above. What file is this? Is it required to create this file?

I work on SAP PI 7.1.1, so will the code in the blog work for me as it is or is there any modification required?

I am even trying to look into this blog: /people/ranjit.deshmukh/blog/2008/01/22/the-hitchhikers-guide-to-validation

Thank you,

Pankaj.

Edited by: Pankaj Sharma XI on Sep 27, 2010 8:19 AM

Former Member
0 Kudos

Hi,

Any help on this?

Thank you,

Pankaj.

Edited by: Pankaj Sharma XI on Sep 29, 2010 7:23 AM