Because there are many customers still using the deprecated SOAP adapter i have decided to create this post in order to help them in this particular situation.
Consider the following scenario:
The orchestration has a subscription through the web port. There is a strong business requirement to validate all the incoming messages, within the response cycle, against an schema already knew by BizTalk (deployed in the Management DB) . Typically, to accomplish this task, we need to create a receive pipeline that validates the incoming message and assign the document schemas property of the XML validator component with the desired deployed schema (s).
Well, in this case, what would be the expected behavior if a validation error is found during the validate stage? if not using the SOAP Adapter, the pipeline will throw a validation exception that subscribed orchestration will catch. Unfortunately, in case of the SOAP adapter this will not happen never and the message will get into the orchestration, with validation errors included, causing a following map to fail with no control at all.
The SOAP Adapter will not cause an exception back to an orchestration when the associated pipeline is getting a validation exception. This has been addressed in previous version of BizTalk with the WSE Adapter and recently by the WCF Adapters. The recommendation in here, if possible, is to move to WCF.
If you have no choice to move to WCF you can do the following:
We are going to take advantage of the feature for executing inline pipelines introduced early in BizTalk 2006.
The idea is simple: Validate the message inside a scope that has a exception block configured to catch the validation exception.
InputPipeline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(MyNameSpace.MyProjectName.MyReceivePipelineName),MsgIn); where MsgIn is the message you are expecting to come through the web service response (the one you have to set up in the receive shape)
InputPipeline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(MyNameSpace.MyProjectName.MyReceivePipelineName),MsgIn);
where MsgIn is the message you are expecting to come through the web service response (the one you have to set up in the receive shape)
In this case the exception information is saved in temp variables to use them later by tracking the values in BAM