编写BizTalk 自定义管道组件的一个意外错误

王朝other·作者佚名  2006-11-29
窄屏简体版  字體: |||超大  

编写BizTalk 自定义管道组件的一个意外错误

作者:郑佐 2006-11-28

假设有一个名为Zhengzuo.BizTalk.Pipelines的组件项目,用来实现一个BizTalk 2006的自定义的管道组件。

以下是笔者编写自定义接收管道组件的一段不完整代码,

[ComponentCategory(CategoryTypes.CATID_PipelineComponent)]

[ComponentCategory(CategoryTypes.CATID_Any)]

[ComponentCategory(CategoryTypes.CATID_Validate)]

[ComponentCategory(CategoryTypes.CATID_DisassemblingParser)]

[System.Runtime.InteropServices.Guid("7EDA198E-6FD8-4046-A974-1C8BF55C3B93")]

public class BoxUpMessageComponent :

IComponent,

IBaseComponent,

IComponentUI,

IPersistPropertyBag,

IDisassemblerComponent

{

private const string description = "管道解码器。编写人:郑佐。\n编写时间:2006-08-1。";

private const string name = "某某管道组件";

private const string version = "1.0.0.0";

}

编译Zhengzuo.BizTalk.Pipelines项目成功,输出到D:\Program Files\Microsoft BizTalk Server 2006\Pipeline Components目录,生成组件为Zhengzuo.BizTalk.Pipelines.dll。

在解决方案中新建一个名为BizTalkTest的BizTalk项目。添加一个发送管道取名为SendPipeline1.btp。打开该发送管道进行编辑,把“某某管道组件”从工具箱拉到解码的位置(如果在工具箱中没有找到“某某管道组件”,在工具箱上右键点击“选择项”菜单,在显示的窗口上选择BizTalk管道组件选项卡,选中“某某管道组件”添加)。

编译BizTalkTest项目,出现一连串错误如下:

错误 11 常量中有换行符

错误 12 意外的字符“:”

错误 13 意外的字符“。”

错误 14 常量中有换行符

错误 15 应输入 ;

错误 16 类、结构或接口成员声明中的标记“:”无效

错误 17 类、结构或接口成员声明中的标记“>”

在BizTalkTest项目文件目录下复制SendPipeline1.btp文件,并修改文件名为SendPipeline1.xml,使用IE或FireFox打开,显示内容如下。

<?xml version="1.0" encoding="utf-16"?>

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" PolicyFilePath="BTSReceivePolicy.xml" MajorVersion="1" MinorVersion="0">

<Description />

<Stages>

<Stage CategoryId="9d0e4103-4cce-4536-83fa-4a5040674ad6">

<Components>

<Component>

<Name>Zhengzuo.BizTalk.Pipelines.BoxUpMessageComponent</Name>

<ComponentName>某某管道组件</ComponentName>

<Description>管道解码器。编写人:郑佐。

编写时间:2006-08-1。</Description>

<Version>1.0.0.0</Version>

<Properties />

<CachedDisplayName>某某管道组件</CachedDisplayName>

<CachedIsManaged>true</CachedIsManaged>

</Component>

</Components>

</Stage>

<Stage CategoryId="9d0e4105-4cce-4536-83fa-4a5040674ad6">

<Components>

<Component>

<Name>Microsoft.BizTalk.Component.FFDasmComp</Name>

<ComponentName>平面文件拆装器</ComponentName>

<Description>流平面文件拆装器组件</Description>

<Version>1.0</Version>

<Properties>

<Property Name="HeaderSpecName" />

<Property Name="DocumentSpecName">

<Value xsi:type="xsd:string">BizTalkTest.SendPipeline1</Value>

</Property>

<Property Name="TrailerSpecName" />

<Property Name="PreserveHeader">

<Value xsi:type="xsd:boolean">false</Value>

</Property>

<Property Name="ValidateDocumentStructure">

<Value xsi:type="xsd:boolean">false</Value>

</Property>

<Property Name="RecoverableInterchangeProcessing">

<Value xsi:type="xsd:boolean">false</Value>

</Property>

</Properties>

<CachedDisplayName>平面文件拆装器</CachedDisplayName>

<CachedIsManaged>true</CachedIsManaged>

</Component>

</Components>

</Stage>

<Stage CategoryId="9d0e410d-4cce-4536-83fa-4a5040674ad6">

<Components />

</Stage>

<Stage CategoryId="9d0e410e-4cce-4536-83fa-4a5040674ad6">

<Components />

</Stage>

</Stages>

</Document>

注意到xml文件的红色标注部分,对应Zhengzuo.BizTalk.Pipelines组件项目中的代码为,

private const string description = "管道解码器。编写人:郑佐。\n编写时间:2006-08-1。";

修改以上代码为

private const string description = "管道解码器。编写人:郑佐。编写时间:2006-08-1。";

修改btp发送管道重新添加“某某管道组件”,编译BizTalkTest项目成功。查看btp文件xml结构为

<Description>管道解码器。编写人:郑佐。编写时间:2006-08-1。</Description>

可见由于“\n”导致项目编译失败。这个算不算是BizTalk Server 2006开发中的一个小bug?

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航