Thursday, January 25, 2007

How to: Pass message to an external assembly

I am trying to write a re-sequencer. I want to be able to pass the message I receive and have an external assembly sort it for me.

The code for the External assembly:

using System;
using System.Diagnostics;
using System.IO;
using System.Xml;
using Microsoft.XLANGs.BaseTypes;

namespace HelperDecompose
public class Class1
public void PrintMessage(XmlDocument inputXML)
Trace.WriteLine("bts- --------------------");
Trace.WriteLine("bts- xml:[" + inputXML.OuterXml + "]");

public void PrintBTSMessage(XLANGMessage btsMessage)
StreamReader reader = new
string sXML = reader.ReadToEnd();
Trace.WriteLine("bts- in the new [" + sXML + "]");

On my expression shape this is the code I have to send the message to the assembly, the xmlDocVariable is of type System.Xml.XmlDocument.

xmlDocVariable = msgOrder;

System.Diagnostics.Trace.WriteLine("bts- before calling Helper assembly");
System.Diagnostics.Trace.WriteLine("bts- [" + xmlDocVariable.OuterXml + "]");

//init the object
oHelper = new HelperDecompose.Class1();

//send the xmlDocument

//send the actual message

System.Diagnostics.Trace.WriteLine("bts- after calling Helper assembly");

Here is my sample code to implement this:


No comments: