Click here to Skip to main content
15,920,708 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: StringFormat.Alignment and StringFormat.LineAlignment Pin
Thomas Stockwell22-Mar-07 8:13
professionalThomas Stockwell22-Mar-07 8:13 
QuestionAccessing files from a remote system or server Pin
vikram.vit10-Mar-07 0:46
vikram.vit10-Mar-07 0:46 
AnswerRe: Accessing files from a remote system or server Pin
Dave Kreskowiak10-Mar-07 4:03
mveDave Kreskowiak10-Mar-07 4:03 
QuestionOpen source team search! Pin
Mehran Farshadmehr9-Mar-07 2:21
Mehran Farshadmehr9-Mar-07 2:21 
AnswerRe: Open source team search! Pin
Vasudevan Deepak Kumar9-Mar-07 6:18
Vasudevan Deepak Kumar9-Mar-07 6:18 
GeneralRe: Open source team search! Pin
Mehran Farshadmehr9-Mar-07 7:56
Mehran Farshadmehr9-Mar-07 7:56 
Questioncustome disassembler for biztalk Pin
sweetdecember1029-Mar-07 0:14
sweetdecember1029-Mar-07 0:14 
AnswerRe: custome disassembler for biztalk Pin
JoeSharp9-Mar-07 0:47
JoeSharp9-Mar-07 0:47 
hi sweetdecember102

sorry for my bad english, i hope you unterstand me Smile | :)

you have to do 2 things: (for BizTalk 2006)

1. write a pipeline that receive the inputmessage. than manipulate it. (see code below)
2. write a disassembler that receive the manipulated message and create the xml message. (see code below)


Pipeline for manipulating the inputmessage. RemoveString and ReplaceStringOld are
properties in the class. you can change this properties in the admin console at runtime. this methode replace CR an LF from the inputmessage and return it.

///
/// Implements IComponent.Execute method.
///

/// <param name="pContext" />Pipeline context
/// <param name="pInMsg" />Input message
/// <returns>Original input message
/// <remarks>
/// IComponent.Execute method is used to initiate
/// the processing of the message in this pipeline component.
///
public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
{
if (Enabled)
{
//Obtain the string of the original message
String inputMessage = string.Empty;
//System.Text.Encoding CurrentEncoding;

using (StreamReader streamReader = new StreamReader(pInMsg.BodyPart.Data, System.Text.Encoding.Default)) //.GetEncoding(this.Encoding)))
{
inputMessage = streamReader.ReadToEnd();
//CurrentEncoding = streamReader.CurrentEncoding;
}

if (RemoveString != null)
{
inputMessage = inputMessage.Replace(RemoveString, String.Empty);
}

if (ReplaceStringOld != null)
{
inputMessage = inputMessage.Replace(ReplaceStringOld, ReplaceStringNew);
}

if (RemoveCR)
{
inputMessage = inputMessage.Replace("\r", "");
}

if (RemoveLF)
{
inputMessage = inputMessage.Replace("\n", "");
}

MemoryStream origms = new MemoryStream(System.Text.Encoding.Default.GetBytes(inputMessage));
origms.Flush();
origms.Position = 0;

pInMsg.BodyPart.Data = origms;
}

return pInMsg;
}


this is the disassembler class methode that receive the manipulated message and return a XML document.


///
/// Builds the interchange from the messages that were added by the previous method.
/// Returns a pointer to the assembled message.
///

/// <param name="pContext" />the current pipeline context
/// <returns>the assembled message instance
public Microsoft.BizTalk.Message.Interop.IBaseMessage Assemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pContext)
{
using (MemoryStream inMemoryStream = new MemoryStream())
{
XmlDocument xmlDocument = new XmlDocument();
Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg = (Microsoft.BizTalk.Message.Interop.IBaseMessage)_inmsgs[0];

byte[] buffer = new byte[inmsg.BodyPart.Data.Length];
inmsg.BodyPart.Data.Read(buffer, 0, buffer.Length);
inMemoryStream.Write(buffer, 0, buffer.Length);
inMemoryStream.Seek(0, SeekOrigin.Begin);
xmlDocument.Load(inMemoryStream);

string messageType = xmlDocument.DocumentElement.NamespaceURI + "#" + xmlDocument.DocumentElement.LocalName;
IDocumentSpec documentSpec = pContext.GetDocumentSpecByType(messageType);

_ffAsmComp.DocumentSpecName = new Microsoft.BizTalk.Component.Utilities.SchemaWithNone(documentSpec.DocSpecStrongName);
}

return _ffAsmComp.Assemble(pContext);
}

regards
Questionhelp me Pin
nandhusivakumar8-Mar-07 23:49
nandhusivakumar8-Mar-07 23:49 
AnswerRe: help me Pin
Mircea Puiu8-Mar-07 23:58
Mircea Puiu8-Mar-07 23:58 
Questionbrowse path with FolderBrowserDialog Pin
mhadamji8-Mar-07 12:12
mhadamji8-Mar-07 12:12 
QuestionHow to have multithread on a socket (one thread read, other thread write) Pin
Spulit8-Mar-07 6:27
Spulit8-Mar-07 6:27 
AnswerRe: How to have multithread on a socket (one thread read, other thread write) Pin
led mike8-Mar-07 7:31
led mike8-Mar-07 7:31 
GeneralRe: How to have multithread on a socket (one thread read, other thread write) Pin
Spulit8-Mar-07 7:39
Spulit8-Mar-07 7:39 
GeneralRe: How to have multithread on a socket (one thread read, other thread write) Pin
pbraun8-Mar-07 9:18
pbraun8-Mar-07 9:18 
GeneralRe: How to have multithread on a socket (one thread read, other thread write) Pin
Spulit8-Mar-07 14:19
Spulit8-Mar-07 14:19 
GeneralRe: How to have multithread on a socket (one thread read, other thread write) Pin
led mike9-Mar-07 4:30
led mike9-Mar-07 4:30 
QuestionHow multiple instances listen to a UDP socket Pin
nsutanto8-Mar-07 5:08
nsutanto8-Mar-07 5:08 
QuestionProcess component and redirecting standard output Pin
SquidDigger8-Mar-07 4:09
SquidDigger8-Mar-07 4:09 
QuestionBreakpoint will not currently be hit Pin
TeachesOfPeaches7-Mar-07 11:03
TeachesOfPeaches7-Mar-07 11:03 
AnswerRe: Breakpoint will not currently be hit Pin
Vasudevan Deepak Kumar7-Mar-07 11:15
Vasudevan Deepak Kumar7-Mar-07 11:15 
GeneralRe: Breakpoint will not currently be hit Pin
TeachesOfPeaches7-Mar-07 12:42
TeachesOfPeaches7-Mar-07 12:42 
AnswerRe: Breakpoint will not currently be hit Pin
kubben7-Mar-07 12:57
kubben7-Mar-07 12:57 
GeneralRe: Breakpoint will not currently be hit Pin
TeachesOfPeaches8-Mar-07 5:17
TeachesOfPeaches8-Mar-07 5:17 
AnswerRe: Breakpoint will not currently be hit Pin
Dave Kreskowiak8-Mar-07 4:32
mveDave Kreskowiak8-Mar-07 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.