Pages

Biz Talk : How To : Throw Custom Exception in Map

Monday, June 3, 2013
post by Brett

I have run into an instance where I need to terminate and raise an exception from within an XSLT template, based on values (or lack thereof) within the source document.  The XSLT transform is running within a BizTalk map.

The secret is the following little-known XSLT construct, which can be conditionally called at any point in the transform:

<xsl:message terminate="yes">Custom error text</xsl:message>
This will cause the XSLT engine to stop processing immediately, and raise an exception.   This exception, including the custom error text contained within the message segment, can be caught in the BizTalk Orchestration engine by explicitly catching an exception of type 

Microsoft.XLANGS.BaseTypes.TransformationFailureException.

No comments:

Post a Comment

Post Your Comment...