The Mystery of ‘Content is not allowed in prolog’
It was interesting when a fellow colleague came to me with what he deemed ‘weird happenings’ in the Development PI box (PI 7.11 SP08).
Here was a straightforward scenario. We pull a file, set it as an attachment and send it over an email. A mail package was used to form the Mail and the content of the email while a Java module did the trick of having both the content and attachment as part of the mail (for those who think it is not possible to have a meaningful email body with a properly named email attachment file, check out this comprehensive blog from madhav poosarla)
Everything was in place as it was supposed to be in place. But then it began to happen.
Every first time the scenario ran, it ended up in a mapping exception;
But what made it weird was that if you restarted the error message manually or it got restarted via the automatic restart, the scenario turned successful.
Now the mapping that created the mail package was definitely failing. But what could be the reason?
It was a simple mapping with all its input fields being constants and a couple of fields being parametrized to make it configurable. There was no way the mapping had issues. Obviously there couldn’t be an issues since on the restart of the same message without making any changes, the mapping ran successfully and thus the scenario execution being completed end to end.
It was then something totally crazy and unrelated came to my mind.
Even though we were not using ICO but the normal configuration scenario, we first tried with removing the SWCV reference from the Sender agreement.
Well, that didnt change any of the result.
Next we tried to remove the SWCV reference in the Receiver Determination;
Guess what, it worked. No more “Content not allowed in prolog” error. Every single time the scenario ran, it worked.
Now how and why does it work? Well, frankly, I got no clue. What do you think folks? Is the SWCV enforcing something during the runtime? If so then why does a restart of the error message end up successfully executing the message?