Monday, September 15, 2008

BizTalk Accelerator for SWIFT 2008 Message Pack

BizTalk Accelerator for SWIFT 2008 Message Pack have been released. Last Friday (September 12), Microsoft published the last Message Pack version for Swift Accelerator.

Download at:
http://www.microsoft.com/downloads/details.aspx?FamilyId=1AF19D56-042F-4B90-9D9A-3B12A34DFDB3&displaylang=en

Saturday, September 06, 2008

Multiple Flat File Schemas Disassembler

The problem with Flat File Disassembler is that doesn't allow multiple Document Schemas as XML Disassembler does.

In the BizTalk SDK, there is a sample pipeline component that allows this feature (see the project inside \Microsoft BizTalk Server 2006\SDK\Samples\Pipelines\SchemaResolverComponent\SchemaResolverFlatFileDasm), but this component only recognizes different documents if them have a Tag Identifier in the first two characters.

My problem was a bit different. The difference between documents is in a concrete position:

DOCUMENT DATA MESSAGE TYPE 65 DOCUMENT DETAIL

The info about wich is the flat file schema is inside the message (in previous sample, was 65 the identifier).

I have modified the SDK sample Pipeline Component to select the correct schema with the info inside the different messages.

First of all, I added two new properties: StartPosition and ReadLength. StartPosition indicates where the identifier characters starts. ReadLength is the identifier's length.
private int startPosition = 0;
private int readLength = 0;

public int StartPosition
{
get
{
return startPosition;
}
set
{
startPosition = value;
}
}

public int ReadLength
{
get
{
return readLength;
}
set
{
readLength = value;
}
}
Second step is to implement the IPersistPropertyBag, to save and load this properties:
public void Load(IPropertyBag propertyBag, int errorLog)
{
object property = null;

propertyBag.Read("StartPosition", out property, errorLog);
if (property != null)
StartPosition = (int)property;

propertyBag.Read("ReadLength", out property, errorLog);
if (property != null)
ReadLength = (int)property;
}

public void Save(IPropertyBag propertyBag, bool clearDirty, bool saveAllProperties)
{
object ptrVar = StartPosition;
propertyBag.Write("StartPosition", ref ptrVar);
ptrVar = ReadLength;
propertyBag.Write("ReadLength", ref ptrVar);
}
Third and last step is modify the Probe method, that reads the message stream, at the StartPosition position ReadLength characters:
public bool Probe(IPipelineContext pContext, IBaseMessage pInMsg)
{
if (null == pContext)
throw new ArgumentNullException("pContext");

if (null == pInMsg)
throw new ArgumentNullException("pInMsg");

if (null == pInMsg.BodyPart || null == pInMsg.BodyPart.GetOriginalDataStream())
return false;

ReadOnlySeekableStream stream = new ReadOnlySeekableStream(pInMsg.BodyPart.GetOriginalDataStream());
Stream sourceStream = pInMsg.BodyPart.GetOriginalDataStream();

if (!sourceStream.CanSeek)
{
ReadOnlySeekableStream seekableStream = new ReadOnlySeekableStream(sourceStream);

pInMsg.BodyPart.Data = seekableStream;

sourceStream = pInMsg.BodyPart.Data;
}

long position = sourceStream.Position;

char[] identifier = new char[ReadLength];
try
{
StreamReader reader = new StreamReader(sourceStream);
reader.BaseStream.Position = StartPosition;
if (reader.Read(identifier, 0, identifier.Length) < identifier.Length)
return false;

}
finally
{
sourceStream.Position = position;
}

string messageType = GetMessageType(new string(identifier));

if (null == messageType)
return false;

IDocumentSpec documentSpec = pContext.GetDocumentSpecByType(messageType);

pInMsg.Context.Write(DOCUMENT_SPEC_NAME_PROPERTY_NAME, XML_NORM_NAMESPACE_URI, documentSpec.DocSpecStrongName);

return disassembler.Probe(pContext, pInMsg);
}
At last, GetMessageType method in SDK sample, hard-coded the schemas DocumentSpec. We can modify this method to retrieve this information from a config file or SSO as config store.

Microsoft announced BizTalk Server 2009

Today Microsoft announced and updated Roadmap for BizTalk Server, including the BizTalk Server 2009 (BizTalk Server 2006 R3) release.

This is a summary of new features announced for this new realease:

* Service Oriented Architecture and Web Services:

- New Web Services Registry: BizTalk Server 2009 includes an UDDI 3.0 registry.
- New Adapters: Oracle E-Business Suites and SQL Server.
- Host Systems Integration: new WCF WebSphere MQ channel to integrate directly with WebSphere MQ via WCF.
- Enhanced Business Activity Monitoring
- Enhanced Enterprise Service Bus Guidance: new features and guidance for applying ESB usage patterns.

* Business to Business Integration:

- Updated SWIFT Support: including an extensibility to support SEPA Routing.
- Enhanced Support for EDI and AS2 Protocols

* Updated Platform Support:

- New Application Platform Support: BizTalk Server 2009 supports the latest Microsoft platform technologies (Windows Server 2008, Visual Studio 2008 SP1, SQL Server 2008 and .NET Framework 3.5 SP1).
- New Hyper-V Virtualization Support
- Improved Failover Clustering

* Device Connectivity:

- New Mobile RFID Platform and device management
- New RFID industry standards support

* Developer and Team Productivity:

- New Application Lifecycle Management (ALM) support: support for Team Foundation Server.
- Enhanced Developer Productivity: improvements in Visual Studio based BizTalk project for debugging maps, pipeline components and XLANG Orchestrations.

* Other Enhancements:

- Messaging: support for recoverable interchange processing for disassembly and validation stage. WCF adapter has been enhanced to provide support for configurable transactions.
- Administration: new query types for tracked message events and tracked service events.

Detailed information in Microsoft BizTalk Server Roadmap.