Re: Execute pipeline in BizTalk Custom Adapter



Not sure this is an easy task. Could you describe why you want to do
that? Maybe we can give you another (better) way of doing it...

--
eliasen, representing himself and not the company he works for.

Private blog:http://blog.eliasen.dk

Private email: j...@xxxxxxxxxx

Hi Jan,
i need to create an custom adapter that can be use directly (filtering
with receive port name) or get the message from orchestration's. this
adapter will get an message as flat file (SWIFT FIN File) and use
SWIFTDasm to convert it to XML Schema which i have more than 255
Schema after that i need to get some data from this xml and make new
xml schema to save data to database.

my last code is
internal class SQLTransmitterEndpoint : AsyncTransmitterEndpoint
{
private static IBaseMessageFactory factory;
private static IPipeline pipeline;
private static IPipelineContext pipelineContext;
public override IBaseMessage ProcessMessage(IBaseMessage message)
{
PipelineFactory factory = new PipelineFactory();
pipeline = factory.CreateReceivePipeline();
Stage stage = factory.CreateDisassembleStage(pipeline);
SQLTransmitterEndpoint.pipelineContext = new
PipelineContext();
IInitializePipelineContext pipelineContext =
(IInitializePipelineContext)SQLTransmitterEndpoint.pipelineContext;
IPropertyBag propertyBag = (IPropertyBag)new
BTMPropertyBag();

IBaseComponent component =
factory.CreatePipelineComponent("Microsoft.Solutions.FinancialServices.SWIFT.Pipelines.SWIFTDasm");
((IPersistPropertyBag)component).Load(propertyBag, 0);
stage.AddComponent(component);

SQLTransmitterEndpoint.factory =
SQLTransmitterEndpoint.pipelineContext.GetMessageFactory();

if (SQLTransmitterEndpoint.factory == null)
{
throw new ApplicationException("Failed to create a
message factory.");
}

pipeline.InputMessages.Add(message);

pipeline.Execute(SQLTransmitterEndpoint.pipelineContext);
IBaseMessage message2 = null;
message2 =
pipeline.GetNextOutputMessage(SQLTransmitterEndpoint.pipelineContext);
.....
.....
}
}

after that when i receive msg like

{1:F01XBANTR2AAAIS8493382015}
{2:O3201450050118YBANUS33AXXX84801544610501190800N}{4:
:15A:
:20:MONEY05011809434
:21:B25654
:22A:NEWT
:30X:20050121
:57A:PNBPUS3NNYC
-}
it convert it to
<UnParsedMessage><![CDATA[{1:F01XBANTR2AAAIS8493382015}
{2:O3201450050118YBANUS33AXXX84801544610501190800N}{4:
:15A:
:20:MONEY05011809434
:21:B25654
:22A:NEWT
:30X:20050121
:57A:PNBPUS3NNYC
-}]]></UnParsedMessage>
any help???

.


Loading