Pages

How to extend flat file disassembler and programatically add a schema to incoming document

Wednesday, June 15, 2011

Q: I want to extend flat file disassembler and programatically add a schema to incoming document. My logic for selecting it works fine but when I try to wire it up to the component it fails in the Disassemble method. It errors out saying that "could not locate document with specification: MyComp.MySchema ... ". Do I need to deploy it to BizTalk before this would work? There are samples showing how to extend FFDasmComp() but these inherit from it and I'm already inheriting from another class. I also tried promoting MessageType property and let BizTalk try to figure out which schema to apply but that in turn produced another error I don't understand (Document schema must be a set). My code looks like this:
public override void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
{
var disassembler = new FFDasmComp();
// here is the code to figure out the schema to go with the FF // and it works fine // this call also seems to be working fine disassembler.DocumentSpecName = new SchemaWithNone("MyComp.MySchema, MySchema, Version=1.0.0.0, Culture=neutral, PublicToken=34ca25f90e3c3dbv);
//and this call fails disassembler.Disassemble(pContext, pInMsg)
}

A:

Yes, you need to deploy your schema for the BizTalk pipeline to resolve correctly.
To resolve the schema correctly, use the IPipelineContext to perform a match, e.g:
// Using the schema .net nameIDocumentSpec docSpec = pContext.GetDocumentSpecByName(mySchemaName); // Alternatively use the MessageType to resolveIDocumentSpec docSpec = pContect.GetDocumentSpecByType(myMessageType); // Then carry on as beforedissassembler.DocumentSpecName = new SchemaWithNone(docSpec.DocSpecStrongName);Hope this helps.

No comments:

Post a Comment

Post Your Comment...