Wednesday, August 16, 2006

Biztalk 2006 - Determine Encoding (Flat File Disassembler Algorithm)

I read in following links:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/BTS06Developing/html/0dbe24fb-c431-4edf-8aa9-4c040d6a7b32.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/BTS06CoreDocs/html/3ea69942-7642-4cd8-befe-63d170eafd4f.asp

That the order to determine the character encoding for a given instance
message in disassemble stage is (without worry about BOM):


1º) If the "Charset" in the body part is set, use it.
2º) If the envelope (or document) schema specifies a code page, use
it.
3º) UTF-8

If we want that Flat File Disassembler uses Charset property of BodyPart, we have to set this property previous the Flat File Disassembler Component call Probe method. I
think this doesn't happen in Biztalk 2004....

Monday, August 14, 2006

Windows Workflow Foundation Beta 2.2 Error - "Procedure or function InsertWorkflow has too many arguments specified"

When we have one of the next errors:

"Procedure or function InsertWorkflow has too many arguments specified."

"ActivityEvents 'sqlTrackingWorkflowInstance.ActivityEvents' threw an exception of type 'System.Data.SqlTypes.SqlNullValueException' System.Collections.Generic.IList {System.Data.SqlTypes.SqlNullValueException}"

We have to update our Tracking Database:

1º) Drop the old Tracking Database.
2º) Copy the new sql scripts from C:\WINDOWS\WinFX\v3.0\Windows Workflow Foundation\SQL\EN with the other scripts.
3º) Create again the Tracking Database

Thursday, July 27, 2006

Correlating using Schemas based on .NET Classes

First of all, we need to create a Biztalk Project wich contains a Property Schema. On this Schema we add the element(s) that we want use for the correlation. For example:


<xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b=
"http://schemas.microsoft.com/BizTalk/2003" xmlns="http://CorrelatingUsingNetSchemas.Schemas.
MessagePropertySchema
" targetNamespace
="http://CorrelatingUsingNetSchemas.Schemas.
MessagePropertySchema
" xmlns:xs=http://www.w3.org/2001/XMLSchema" >
<xs:annotation>
<xs:appinfo>
<b:schemaInfo schema_type="property" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="ClientID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo propertyGuid="1d3dc261-f5ef-4294-a6f3-d7c3f172aea0" propSchFieldBase="MessageDataPropertyBase" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:schema>

Next, we need to add to our solution a .NET Class Library Project. This project must have a reference to Biztalk Project wich contains our Property Schema and a reference to Microsoft.XLANGs.BaseTypes.dll.

Inside this Project we add a class that represents our message schema. This class must be declared as a Serialized Class:

using System;
namespace CorrelatingUsingNetSchemas.NetBasedSchema
{
///
/// My .NET Class based Schema
///

[Serializable ()]
public class SchemaClass
{
}
}


For Correlation, we need to use a promoted property. The promotion of the property must be achieved using a Property Schema, NOT by Distinguished Fields.

To achieve this requisites, first we need to declare a attribute. Type of this attribute must be the type of the Property Schema Field:

// Attribute for correlate
private string _clientID;

For declare the property, we need to declare a Class Property on our Class, that manages the attribute previously declared:

// Property for correlate
public string IDClient
{
get
{
return _clientID;
}
set
{
_clientID = value;
}
}

Now, we only need to say that our property is a Biztalk Property. The type of this property is based on our Property Schema:

// Property for correlate
[Microsoft.XLANGs.BaseTypes.Property (typeof(CorrelatingUsingNetSchemas.Schemas.ClientID))]
public string IDClient
{
get
{
return _clientID;
}
set
{
_clientID = value;
}
}