Logo
HOW TO
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

BizTalk 2006 : Custom Components (part 2) - Key BizTalk API Objects

8/3/2014 9:28:42 PM

Key BizTalk API Objects

All pipeline components, regardless of what they do, will use the interfaces described in thefollowing subsections. Likewise, most of the pipeline component interfaces defined previously accept these interfaces as arguments. That being said, it is important to understand these interfaces first before proceeding. The following is based on material from the BizTalk Server documentation on MSDN.

IPipelineContext

IPipelineContext is the main interface that defines the operations and properties for thepipeline instance. The MSDN documentation from Microsoft provides good examples for how these interfaces are to be used. Tables 1 and 2 show the interface's public properties and methods. The key method here is the GetMessageFactory method. This method will return a message factory for the pipeline that can be used to create new messages using the CreateMessage method.

The GetMessageFactory method is the main way to create new messages from withina pipeline component. Also note that you will need to call IPipelineContext. GetMessageFactory.CreateMessagePart to create the message part for the message. A message is simply a construct that contains zero to many message parts. Once you create the message part, you can assign it to the IBaseMessage object through the AddPart method.

Table 1. PipelineContext Public Properties
PropertyDescription 
ComponentIndexGets the index of the current component in the stage.
PipelineIDGets the ID of the pipeline with which this pipeline context associates.
PipelineNameGets the name of the pipeline.
ResourceTrackerGets the IResourceTracker object associated with the pipeline context. This object can be used to track and dispose non-CLR resources.
StageIDGets the ID of the current stage in the pipeline.
StagendexGets the index of the pipeline stage where the current component is located.

Table 2 . PipelineContext Public Methods
MethodDescription
GetDocumentSpecByNameGets an IDocumentSpec object for the specified document name
GetDocumentSpecByTypeGets an IDocumentSpec object for the specified document type
GetGroupSigningCertificateGets the signing certificate for the group
GetMessageFactoryGet access to the helper interface to work with BizTalk Server message objects

IBaseMessage

IBaseMessage is the base interface that defines a BizTalk Server message. Tables 3 and Table 4 show the public properties and methods. The MSDN documentation from Microsoft provides good examples for how these interfaces are to be used. Note that messages, created using the IPipelineContext.GetMessageFactory.CreateMessage method, will implement this interface. This will still need an IBaseMessagePart to be assigned through the AddPart method for any data to be included with the message.


Table 3. IBaseMessage Public Properties
PropertyDescription
BodyPartGets the body part, or main part, of the message
BodyPartNameGets the name of the body part, or main part, of the message
ContextGets or sets the message context
IsMutableGets a value indicating whether the message can be changed by components during processing
MessageIDGets the unique message ID for the message
PartCountGets the total number of parts in the message

Table 4. IBaseMessage Public Methods
MethodDescription
AddPartAdds a part to the message.
GetErrorInfoGets the exception that caused the error.
GetPartAccesses the message part. This is indexed by PartName.
GetPartByIndexRetrieves a part and its name by supplying the part index.
GetSizeGets the size of the message.
RemovePartRemoves a part from the message.
SetErrorInfoSets the error information.

IBaseMessagePart

IBaseMessagePart is the interface that defines a BizTalk message part. Table 5 and Table 6 show its public properties and methods. The message part is assigned to an IBaseMessage through the AddPart method. Note the Data property. The MSDN documentation from Microsoft provides good examples for how th. This is the property used to assign a value to the message part. The Data property accepts and returns only streams. This is incredibly useful, as it allows any stream to be assigned to the message part. This includes XMLReader streams, MemoryStreams, and raw BinaryStreams.

Another rarely used item is the PartProperties property. This is essentially a property bag that can be used to store information and metadata about the part. In reality the PartID, Charset, and ContentType are actually contained in the PartProperties IBasePropertyBag object.

Table 5. IBaseMessagePart Public Properties
PropertyDescription
CharsetGets or sets the character set property for the part
ContentTypeGets or sets the content type property for the part
DataGets or sets the part data
PartIDGets the part with a unique ID
PartPropertiesGets or sets one or more properties that describe the part data or contain custom information about the part

Table 6. IBaseMessagePart Public Properties
MethodDescription
GetOriginalDataStreamRetrieves the original uncloned version of the part data stream
GetSizeRetrieves the size of the part

IBaseMessageContext

IBaseMessageContext is the interface used to interact with and manipulate the object context accessible through the IBaseMessage.Context property. Table 7 and Table 8 show the public properties and methods. The MSDN documentation from Microsoft provides good examples for how these interfaces are to be used. The main items of interest here are the Promote, Read, and Write methods. Properties that exist in the context can never have a Null value. A Null value means that the property does not exist. For example:


  • Attempting to set (or promote) a property value to Null deletes the property and returns the COM result S_OK.

  • Attempting to read a nonexistent property returns Null.

Table 7. IBaseMessageContext Public Property
PropertyDescription
CountPropertiesGets the number of properties in the message context

Table 8. IBaseMessageContext Public Methods
MethodDescription
AddPredicateAdds a message predicate to the message
GetPropertyTypeGets the type of the property
IsMutableIndicates whether the message context can be changed by components during processing
IsPromotedEnables the component to determine whether a property has already been promoted in the message context
PromotePromotes a property into the message context
ReadGets a property value from the message context by the name-namespace pair
ReadAtGets a property from the message context by index
WriteWrites a property into the message context

PipelineUtil

PipelineUtil is a helper class that exposes the three methods shown in Table 9. These methods are invaluable when you need to create a new message. The MSDN documentation from Microsoft provides good examples for how these interfaces are to be used.


Table 9. PipelineUtil PublicMethods
MethodDescription
CloneMessageContextCreates a clone of the message context for a given message. This is useful for copying the message context of one message to another.
CopyPropertyBagCreates a clone of the property bag for a given message. This is useful for copying the property bag of one message to another.
ValidatePropertyValueChecks that the object is a valid property value.

This class is unsupported and is part of the BizTalk product infrastructure. If you run into trouble using it, Microsoft Product Support may not support you. However, it is common knowledge that it exists and makes pipeline component development much easier.

Other -----------------
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Enabling Archiving (part 2) - Using Exchange 2010 Discovery, Offline Access
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Enabling Archiving (part 1) - Archive Quotas , Exchange 2010 Discovery Operation Considerations
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Placing a Mailbox on Retention Hold, Litigation or Legal Hold
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Exchange Server 2010 Email Archiving - Policies
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Industry Best Practices
- Microsoft Exchange Server 2010 : Getting Started with Email Archiving - Archiving
- Microsoft Exchange Server 2007 : Implementing Client Access and Hub Transport Servers - Installing the Hub Transport Server
- Microsoft Exchange Server 2007 : Implementing Client Access and Hub Transport Servers - Transport Pipeline
- Microsoft Exchange Server 2007 : Hub Transport Server Policy Compliance Features (part 4) - Message Classification , Rights Management and the Hub Transport Server
- Microsoft Exchange Server 2007 : Hub Transport Server Policy Compliance Features (part 3) - Journaling
 
 
REVIEW
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
 
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
Top 10
- Microsoft Excel : How to Use the VLookUp Function
- Fix and Tweak Graphics and Video (part 3) : How to Fix : My Screen Is Sluggish - Adjust Hardware Acceleration
- Fix and Tweak Graphics and Video (part 2) : How to Fix : Text on My Screen Is Too Small
- Fix and Tweak Graphics and Video (part 1) : How to Fix : Adjust the Resolution
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro