I came across a great simple sample of how to do this and thought I show how easy
it is to do this.

A whole bunch of BizTalk Samples from the Developer Team is here:
BizTalk Samples

One of the samples on the page is the ConsoleAdapter – very simple, non Adapter framework
receive adapter. This is an isolated adapter.

Here’s the crux of the sample – In particular look at the ProcessMessage function.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.BizTalk.Interop;
using Microsoft.BizTalk.Messaging.Interop;
using Microsoft.BizTalk.TransportProxy.Interop;
using Microsoft.BizTalk.Adapter.Framework;
using System.Globalization;
using System.Resources;
using Microsoft.BizTalk.Message.Interop;
using System.IO;

namespace Microsoft.Samples.BizTalk.Adapters.ConsoleAdapterLibrary
{
public class ConsoleAdapter : IBTTransport, IBTTransportConfig, IBTBatchCallBack
{
~ConsoleAdapter()
{
// Class destructor called by default right before ConsoleAdapter class is being
// destroyed. This method makes required call to TermiateIsolatedReceiver to

// match previous calls to RegisterIsolatedReceiver in the Register method.
_tp.TerminateIsolatedReceiver();
}

static ConsoleAdapter()
{
// Default class constructor called by default as ConsoleAdapter class is being
// instantiated. This method accepts a string as input from the command line and

// calls the SendMesage helper method to submit it to BizTalk Server.
// Multiple messages can be submitted by entering numerous strings and hitting <ENTER>.
// To end the progam hit <CTRL-C> and it will exit.
Console.WriteLine(“Type in message text and hit <ENTER> for each BizTalk Server
message. Hit <CTRL-C> to exit.”);
string data = Console.ReadLine();

do
{
// Submit the msssage to BizTalk Server
SendMessage(data);
data = “”
data = Console.ReadLine();
}
while(true);
}
static void SendMessage(string data)
{
// Helper method called by the default class constructor immediately following the
// ConsoleAdapter class being instantiated. This method accepts a string as input.
// That string is used as part (the body) of the message which is submitted in a

// (single) message batch to the BizTalk Server Messaging Engine. This method is
// called once for each message to be submitted.

// If the adapter instance is registered with BizTalk then proceed.
Otherwise this

// is the first message being submitted so register the adapter instance as an

// isolated recevier with BizTalk Server.
if (!Registered)
Register();

// Create a message part containing the string and adds it to
the message
IBaseMessagePart part = _fact.CreateMessagePart();
IBaseMessage msg = _fact.CreateMessage();
MemoryStream ms = new MemoryStream();
StreamWriter sw = new StreamWriter(ms);
sw.Write(data);
sw.Flush();
ms.Seek(0, SeekOrigin.Begin);
part.Data = ms;
msg.AddPart(MESSAGE_BODY, part, true);

// Create a new context for a message.
SystemMessageContext context = new SystemMessageContext(msg.Context);

// _url is consoleadaptertestharness.exe
context.InboundTransportLocation = _url;
context.InboundTransportType = “Console”

// Obtain a batch from the Messaging Engine proxy and submit
the message via the batch.
IBTTransportBatch batch = _tp.GetBatch(_cb, _cb);
batch.SubmitMessage(msg);
batch.Done(null);

}
void ProcessMessage(Stream s)
{
//This gets us the interface to the Messaging Engine
IBTTransportProxy tp = GetProxy();
//get the message factory

IBaseMessageFactory msgfact;
msgfact = tp.GetMessageFactory();
IBaseMessage msg;
//create the message object
msg = msgfact.CreateMessage();
IBaseMessagePart part;
//create the part – in this case

//the only part
part = msgfact.CreateMessagePart();
//give the part the stream
part.Data = s;
//add the part
msg.AddPart(“body”, part, true);
IBTTransportBatch batch;
//get the bacth – the object
//used to send messages
batch = tp.GetBatch(this, null);
//submit the message – in this case
//this is a one-way MEP
batch.SubmitMessage(msg);
//tell the batch we’re done
batch.Done(null);

}
IBTTransportProxy GetProxy()
{
// Helper function to return a pointer to the proxy.
return _tp;
}
static void Register()
{
// Get the transport proxy and use it to register the adapter and it’s receive location

// with BizTalk Server.
_tp = new BTTransportProxy() as IBTTransportProxy;
_tp.RegisterIsolatedReceiver(_url, _instance);
_fact = _tp.GetMessageFactory();
Registered = true;

}
private static CB _cb = new CB();
private static string MESSAGE_BODY = “body”
//Need to have a receive location by this same name “ConsoleAdapterTestHarness.exe”
static string _url = “ConsoleAdapterTestHarness.exe”//System.Diagnostics.Process.GetCurrentProcess().ProcessName;
static IBaseMessageFactory _fact = null;
static ConsoleAdapter _instance = new ConsoleAdapter();
static IBTTransportProxy _tp = null;
static bool Registered = false;
public Guid ClassID { get { return new Guid(“{82A2D6BC-F1CA-4ad5-80AA-ED7B7A52B493}”);
} }
public string Description { get { return “Description” } }
public string Name { get { return “Console Adapter” } }
public string TransportType { get { return “Console” } }
public string Version { get { return “1.0.0.0” } }

void IBTTransportConfig.AddReceiveEndpoint(string url, Microsoft.BizTalk.Component.Interop.IPropertyBag
adapterConfig, Microsoft.BizTalk.Component.Interop.IPropertyBag bizTalkConfig)
{

}

void IBTTransportConfig.RemoveReceiveEndpoint(string url)
{

}

void IBTTransportConfig.UpdateEndpointConfig(string url, Microsoft.BizTalk.Component.Interop.IPropertyBag
adapterConfig, Microsoft.BizTalk.Component.Interop.IPropertyBag bizTalkConfig)
{

}
public void BatchComplete(int status, short opCount, BTBatchOperationStatus[] operationStatus,
object callbackCookie)
{

}
}
public class CB : IBTBatchCallBack
{
#region IBTBatchCallBack Members

public void BatchComplete(int status, short opCount, BTBatchOperationStatus[]
operationStatus, object callbackCookie)
{

}

#endregion
}
public class ConsoleAdapterConfig : IAdapterConfig
{
#region IAdapterConfig Members

public string GetConfigSchema(Microsoft.BizTalk.Adapter.Framework.ConfigType
configType)
{
switch (configType)
{
case ConfigType.ReceiveHandler:
return GetResource(“ReceiveHandler”);

case ConfigType.ReceiveLocation:
return GetResource(“ReceiveLocation”);

default:
return null;
}
}
string GetResource(string name)
{
ResourceManager rm = ConsoleAdapterLibrary.ConsoleAdapterRes.ResourceManager;
return rm.GetString(name);

}
public Microsoft.BizTalk.Adapter.Framework.Result GetSchema(string uri, string namespaceName,
out string fileLocation)
{
// TODO: Add RemotingAdapterConfig.GetSchema implementation
fileLocation = String.Empty;
return Result.Continue;
}

#endregion
}

}