How handling error adapter WCF

I’m working with a custom WCF adapter, and now we get some issue when pipeline failed validation : here is the MSDN explanation to handle it

For a receive location, you can configure one of two error handling options under the Error Handling section on the Messages tab in the Transport Properties dialog box.

If the Suspend request message on failure option is selected, the incoming request message will be suspended should there be a processing failure in the receive pipeline or a failure in the routing of the message. This allows the sender of the message to succeed in their transmission to BizTalk Server and receive an acknowledgment (ACK) message. BizTalk Server will suspend the message and record a complete error record for the failed message. However, it also does not send the message exception back to the sender in this case. This applies to one-way ports only and will send an ACK if checked, and if unchecked will send a NACK. For two-way ports, if processing fails, BizTalk will always receive a NACK.

However, if the client needs to have access to the failed exception, select the Include exception details in faults option. When selected, this returns a SOAP fault to the caller if a processing error occurs. This is the same as specifying the serviceDebug behavior with “IncludeExceptionDetailsInFaults” to True on the Behavior tab of the WCF-Custom or WCF-CustomIsolated adapters. The detailed exception is now sent to the client. This option is more practical and safer to use during development of an application than in production because the internal fault messages most likely should not be sent to callers of the service.

For the two-way send port, you can choose whether to forward SOAP fault messages on to the original caller over a solicit-response send port by selecting Propagate fault message. If this option is not selected, BizTalk Server will generate a NACK first, and then suspend the message. If it is selected, BizTalk Server will treat the message as a valid WCF response message from the external service and the response message will not be suspended because it is propagated.

schedulerTask Adapter new Release

A new release of the SchedulerTask Adapter is available.

remind, The BizTalk Scheduled Task Adapter is an in process receive adapter that can be implemented on a receive location to execute a prescribed task on a daily, weekly or monthly schedule.

So Bye bye windows scheduler, this adapter is very powerfull and now it’s in native .NET 4.0. Thanks to Sandro Pereira who made the new version

here is the improvment list :

  • 24 hours support in “start time” property. Previous versions had an issue with setting the start time, as it shown 12 hours watch but no AM/PM.
  • Daily scheduler review. Solved a small bug on Daily Properties: unable to switch between “Every day” and “on these days”
  • Installation experience improved. You no longer need to manually add the DLL in GAC.
  • Support for 32 and 64 bit Host Instances.
  • Compiled in Visual Studio 2010 and .NET Framework 4.0.
  • Optimized for BizTalk Server 2010.
  • Documentation improved.

To download and test it :


Create BizTalk Adapter using power shell

For production environnement, you potentially don’t have any access to the plateform, so you need to script any object creation. Here is the guid to script adapter creation.

On your development environement you need to get two importants parameters :

  • Create your adapter on your BizTalk adapter -> create new adapter
  • Put a name and a comment
  • Apply
  • Open SQL Management Studio
  • connect the BizTalkLMgmtDb
  • execute this query : SELECT Name, Capabilities, MgmtCLSID  FROM [BizTalkMgmtDb].[dbo].[adm_Adapter] WHERE name=‘YourAdapterName’
  • capabilities is the adapter constraints (clic here to understand how does it work)
  • MgmtCLSID  is the Adapter ID
  • Next in your power shell create this method
  • the parameters$Name, $Comment are the same  that you indicate in the create adapter windows :

function CreateadapterInstance($Name,$Comment)

     $AdapterClass = [wmiclass] « root\MicrosoftBizTalkServer:MSBTS_AdapterSetting »

     $Adapter = $AdapterClass.CreateInstance()
     $Adapter.MgmtCLSID = « {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} »  #Be careful a guid must be provided with brace for WMI 

     $Adapter.Constraints = 1100001011 #convert the capabilities number in binaries format

WCF-SQL and XML parameter

WCF-SQL can be used with a Stored Procedure that has an XML parameter.

The Xml parameter is converted in a string parameter in the generated code. So for passing an XML, you need to convert it in string with encoding.

It exists a simpler manner :

  • In your orchestration, only create your XML parameter as a message
  • Send it via your send port to WCF-SQL
  • Now in the send port click on configure
  • Click the Messages tab, and in the Outbound WCF message body section, choose the Template option.
  • In the XML text box, specify the template that will be used to construct the WCF message. By doing so, you create a message that conforms to the operation for the WCF-based SQL adapter
  • For the ADD_LAST_EMP_XML_INFO stored procedure, you must specify the following template:
    <ADD_LAST_EMP_XML_INFO xmlns="">
    <bts-msg-body xmlns="" encoding="string"/> </xml_info>
  • The Tag encoding is very important. By specifying string, it’ll replace <> and other special caracter by their encoding (like &gt; …)

This method  is very powerfull, the only problem is you need to ensure that your schema is up to date manually

For more information see MSDN :