AssemblyExecuteAdapter
BizTalk custom adapter
AssemblyExecuteAdapter
功能
更为方便的扩展BizTalk custom adapter 的交互方式,只需要实现IAssemblyExecute 接口就可以让BizTalk AssemblyExecuteAdapter 执行需要的业务逻辑。
代码
AssemblyExecuteAdapterTransmitterEndpoint.cs
通过配置需要加载的dll 文件来执行dll 内部处理逻辑
private Stream SendAssemblyExecuteAdapterRequest(IBaseMessage msg, AssemblyExecuteAdapterTransmitProperties config)
{
VirtualStream responseStream = null;
string charset = string.Empty;
IBaseMessagePart bodyPart = msg.BodyPart;
Stream btsStream;
string messageid = msg.MessageID.ToString("D");
if (null != bodyPart && (null != (btsStream = bodyPart.GetOriginalDataStream())))
{
try
{
Type assemblyExecuteType = Type.GetType(config.AssemblyName);
IAssemblyExecute assemblyexecute = (IAssemblyExecute)Activator.CreateInstance(assemblyExecuteType);
object inputparameters = null;
if (!string.IsNullOrEmpty(config.InputParameterXml))
{
XmlDocument inputXml = new XmlDocument();
inputXml.LoadXml(config.InputParameterXml);
inputparameters = assemblyexecute.GetInputParameter(inputXml);
}
Stream stream = assemblyexecute.ExecuteResponse(btsStream, inputparameters);
#region saveresponsemessage
string responsefilename = string.Empty;
if (config.SaveResponseMessagePath != string.Empty && config.SaveResponseMessagePath != "N")
{
if (!Directory.Exists(config.SaveResponseMessagePath))
Directory.CreateDirectory(config.SaveResponseMessagePath);
responsefilename = Path.Combine(config.SaveResponseMessagePath, "res_" + messageid + ".txt");
SaveFile(responsefilename, stream);
stream.Seek(0, SeekOrigin.Begin);
}
#endregion
if (config.IsTwoWay)
{
responseStream = new VirtualStream(stream);
}
}
catch(Exception e)
{
#region saveerrormessage
string errorfilename = string.Empty;
if (config.SaveErrorMessagePath != string.Empty && config.SaveErrorMessagePath != "N") {
if (!Directory.Exists(config.SaveErrorMessagePath))
Directory.CreateDirectory(config.SaveErrorMessagePath);
errorfilename = Path.Combine(config.SaveErrorMessagePath ,messageid + ".txt");
SaveFile(errorfilename, btsStream);
}
#endregion
string Source = "AssemblyExecuteAdapter";
string Log = "Application";
string Event = e.Message + "\r\n request message saved :" + errorfilename;
if (!EventLog.SourceExists(Source))
EventLog.CreateEventSource(Source, Log);
EventLog.WriteEntry(Source, Event, EventLogEntryType.Error);
throw;
}
}
return responseStream;
}
配置
配置发送端口

配置参数

Assembly qualified name:实现了IAssemblyExecute接口的dll文件
Function Name: 这个adapter的功能名称,确保唯一
Input Parameter Xml: 执行ExecuteResponse需要的参数以XML的形式提供
Save Error Message Path:保存错误报文的路径
Save Response Message Path:保存执行ExecuteResponse方法返回的结果
选择实现了IAssemblyExecute 接口的dll文件

编辑输入参数

AssemblyExecuteAdapter的更多相关文章
随机推荐
- C# Redis实战(三)
三.程序配置 在C# Redis实战(二)中我们安装好了Redis的系统服务,此时Redis服务已经运行. 现在我们需要让我们的程序能正确读取到Redis服务地址等一系列的配置信息,首先,需要在Web ...
- js改变盒子大小(上下左右)分析
js改变盒子大小 知识点 三个mouse事件:mousedown mousemove mouseup css的定位和cursor 思路 先解决单边问题识别范围,得到所选区域 event. 根据距离,判 ...
- 删除项目中的.pyc文件
在编写python项目的时候,往往会生成很多的.pyc文件,但是在我们提交代码的时候这些.pyc文件又是不必要的,所以需要对项目里面的.pyc文件进行清理.再此,经过我的查阅资料和尝试,分享出以下方法 ...
- AJAX学习笔记2:XHR实现跨域资源共享(CORS)以及和JSONP的对比----转载
1 前言: 首先对参考文章作者表示感谢,你们的经验总结给我们这些新手提供了太多资源.本文致力于解决AJAX的CORS问题,我在逻辑上进行了梳理:首先,系统的总结了CORS问题的起源-同源策略:其次,介 ...
- loadrunner 录制中文出现乱码的解决办法
- 笔记:Hibernate DML
Hibernate 提供的HQL(Hibernate Query Language)语句也支持批量 update 和 delete 语法,语法格式如下: [UPDATE | DELETE] FROM ...
- RxJS速成 (下)
上一部分: http://www.cnblogs.com/cgzl/p/8641738.html Subject Subject比较特殊, 它即是Observable又是Observer. 作为Obs ...
- Scala中 object 和 class的区别
object 在scala中没有静态方法和静态字段,所以在scala中可以用object来实现这些功能,直接用对象名调用的方法都是采用这种实现方式,例如Array.toString.对象的构造器在第一 ...
- 【JS】 Javascript与HTML DOM的互动 寻路
JS HTML DOM DOM的全程是Document Object Module,即文档对象模型.一般来说,当一个页面被加载时,浏览器会在内部创建一个当前文档的DOM.就像用python的Etree ...
- linux --> 获取系统启动时间
获取系统启动时间 一.前言 时间对操作系统来说非常重要,从内核级到应用层,时间的表达方式及精度各部相同.linux内核里面用一个名为jiffes的常量来计算时间戳.应用层有time.getdaytim ...