27 February 2008

Guidance Explorer

I stumbled upon a very useful tool - Guidance Explorer . If you're into design patterns and best practices, take a look at this (free) tool, its well worth it.

12 October 2007

XML Serialization

I've been having to do some custom serialization in BizTalk and wanted to share some lessons learnt:

The System.Xml.Serialization.XmlSerializer class does the serializing and deserializing of class objects. There are some constraints that the class must observe:
1) Only public properties will be serialized, private ones are ignored totally
2) The class must be public too and it needs a parameterless constructor

Serialization example:

MyClass myClass = new MyClass();
FileStream myFileStream = new FileStream(@"C:\output.xml", FileMode.Open, FileAccess.Write);

XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
serializer.Serialize(myFileStream, myClass);


If you have a schema for your xml data, use the xsd utility to generate the class:
C:\Program Files\Microsoft Visual Studio 8\VC\xsd MySchema.xsd /classes

I'll comment more about using the IXmlSerializable interface in the future (note that the ReadXml method needs to rehydrate inner objects), but for now thats all.

BizTalk Error

I have come across yet another error in BizTalk, I'll be looking into this one and posting a solution as soon as I find it:

Microsoft.XLANGs.Core.XlangSoapException: An error occurred while processing the message, refer to the details section for more information
Message ID: {AD19FF31-B1EB-45C2-84C8-717C9AA55E4F}
Instance ID: {6AFEEE47-42DC-4EC7-B4BB-7E674597F5C6}
Error Description: Object reference not set to an instance of an object.

at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx)
at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly)
at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location)