A few weeks ago, while improving an existing solution to fulfill the new business requirements, I encountered the following error while trying to validate or test a BizTalk map:
“Exception Caught: The map contains a reference to a schema node that is not valid. Perhaps the schema has changed. Try reloading the map in the BizTalk Mapper. The XSD XPath of the node is: /*[local-name()='<Schema>’]/*[local-name()=’MyRootNode’]/*[local-name()=’MyRecord]/*[local-name()=’MyElement’]”
To contextualize the problem, the BizTalk Visual Studio solution I was working on was composed of several projects, but for the propose of this error, let’s say that we had two projects:
- Schemas Project: containing all the schemas used by the BizTalk Solution;
- Map Project: containing all the maps used by the BizTalk Solution;
I did the necessary changes in the source schema and they were automatically reflected in the map that I was working on without the need to rebuild the Schema Project. And when I try to test the map, after making all the necessary changes on it, I got the above error.
Which was a little awkward at the point because indeed I changed the contract of the source schema but it was reflected in the map that I was working on. Everything seemed fine, I even try to close and open the map again, but that did not solve the problem
Again, the reason for this error is awkward because the schemas changes were reflected on the map, even if it was a different solution and without rebuilding the Schema Solution. However, the cause for this error is that is referring an invalid or incorrect version of the Schema assembly.
The solution to solve “The map contains a reference to a schema node that is not valid” issue is simple, you just need to rebuild the entire solution or rebuild the schema project before you try to validate or test the maps.
After the Schema project solution is rebuilt, the problem will disappear and you will be able to validate or test the map.