您需要在类附近实现IProbeMessage 我忘了在文章的代码中添加IProbeMessage。它现在更新。 但它是示例源代码中的
Src1是架构的根节点名称。我在文章中提到消息类型是TargetNamespace #Root
我建议下载示例代码
我希望这能帮到您
在您链接的示例中,管道组件的探测方法是将文件名中的前4个字符推送到键入的消息中,然后将其传递到规则引擎中。它的4个字符与示例中的“SRC1”匹配。
string srcFileName = pInMsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties This link is external to TechNet Wiki. It will open in a new window. ").ToString(); srcFileName = Path.GetFileName(srcFileName); //Substring the first four digits to take source code to use to call BRE API string customerCode = srcFileName.Substring(0, 4); //create an instance of the XML object XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(string.Format(@"<ns0:Root xmlns:ns0='http://TechNetWiki.SchemaResolver.Schemas.SchemaResolverBRE This link is external to TechNet Wiki. It will open in a new window. '> <SrcCode>{0}</SrcCode> <MessageType></MessageType> </ns0:Root>", customerCode)); //retreive source code in case in our cache dictionary if (cachedSources.ContainsKey(customerCode)) { messageType = cachedSources[customerCode]; } else { TypedXmlDocument typedXmlDocument = new TypedXmlDocument("TechNetWiki.SchemaResolver.Schemas.SchemaResolverBRE", xmlDoc); Microsoft.RuleEngine.Policy policy = new Microsoft.RuleEngine.Policy("SchemaResolverPolicy"); policy.Execute(typedXmlDocument);
因此匹配规则基于文件名的前4个字符。如果一个不匹配,则探测器返回false - 即未识别。
最后一部分是将消息类型推送到返回的消息中 - 这个 由。。。制成由。。。做成 命名空间和带有#separator的根模式节点 - 所以#ssrc1是根节点。