【问题标题】:Getting schema information within a biztalk pipeline component在 biztalk 管道组件中获取模式信息
【发布时间】:2013-02-06 17:19:27
【问题描述】:

早上好, 我有兴趣编写一个知道它正在解码的文档模式的管道组件。我看到有一个函数可以获取组件内的架构信息:

IDocumentSpec spec = pContext.GetDocumentSpecByType("name-of-your-schema");

您可以访问在管道中分配的文档架构名称吗?

【问题讨论】:

    标签: c# biztalk biztalk-2010


    【解决方案1】:

    您可以像这样从消息的上下文中获取它:

    private static readonly PropertyBase SchemaStrongNameProperty = new BTS.SchemaStrongName();
    private static readonly PropertyBase MessageTypeProperty = new BTS.MessageType();
    
    public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
    {
        // Get by schema strong name (.NET type)
        string schemaStrongName = pInMsg.Context.Read(SchemaStrongNameProperty.Name.Name, SchemaStrongNameProperty.Name.Namespace) as string;
        pContext.GetDocumentSpecByName(schemaStrongName);
    
        // Get by message type (XML NS#Root Node)
        string messageType = pInMsg.Context.Read(MessageTypeProperty.Name.Name, MessageTypeProperty.Name.Namespace) as string;
        pContext.GetDocumentSpecByType(messageType);
    
        // Rest of your pipeline component's code...
    }
    

    【讨论】:

    • 看起来正是我想要的。我会试试看。谢谢!
    • 不幸的是 pInMsg.Context.Read() 方法返回 null。在运行时 SchemaStrongNameProperty.Name.Name = "SchemaStrongName"。命名空间是“schemas.microsoft.com/BizTalk/2003/system-properties”。架构强名称不在消息上下文中。
    • 您的组件将在哪个阶段运行?
    • 我打算在反汇编阶段使用它。也许我需要重写它才能在验证阶段工作?我实际上是在尝试使用架构中的信息来清理数据。在拆卸后进行此操作也可以。
    • 我认为验证阶段最好。反汇编程序会设置该信息,因此您必须在那之后进行。
    猜你喜欢
    • 2012-11-25
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-15
    • 2012-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多