Wednesday, August 20, 2008

Schema Validation at Port level

Situation:
When receiving a message at the Receive Port (Location). BizTalk isn't really validating the incoming Xml against th Xsd.

What is happening is that BizTalk looks at the NameSpace + Root Element, place it in the MessageBox and the Orchestrations will pick it up.

But in meany cases, we want to validate the incoming Xml and be sure that the Xml corrspond to the Xsd

Solution:
- On the receive port, select the XmlReceive Pipeline



- Click on th Properties of the XmlReceive Pipeline
- Set ValidateDocument to true
- Fill in the DocumentSpecNames property



How to find the DocumentSpecNames Value ?

- In the BizTalk Admin Console, go to the BizTalk Application
- Click on the Schemas
- Got to the properties of the Schema you want to Validate
- Concatenate the value of Name and Assembly, using a comma

[Name Value],[Assembly Value]



When using this method, the incoming Xml file will be validated against the given schema. When an error occured in th validation, an error will be written to the eventlog.

No comments: