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的更多相关文章
随机推荐
- MyBatis笔试题
1请写出Mybatis核心配置文件MyBatis-config.xml的内容? <?xml version="1.0" encoding="UTF-8"? ...
- 使用MyBatis 框架犯的错误
最近做项目,数据层使用的是MyBatis框架,在使用过程中,犯了一些错误: resultMap和resultType书写错误导致问题 resultMap和resultType二者用法不一样: resu ...
- luogu3244 bzoj4011 HNOI2015 落忆枫音
这道题目题面真长,废话一堆. 另外:这大概是我第一道独立做出来的HNOI2011年以后的题目了吧.像我水平这么差的都能做出来,dalao您不妨试一下自己想想? 题目大意:给一个DAG,其中1号点没有入 ...
- BZOJ4825 单旋
分析:一道水题,去年考场发现了特点但是不会splay维护挂了,然后现在我写了个treap. 画一画图就可以解决这道题了,自己试一下. 代码如下: #include<bits/stdc++.h&g ...
- oracle 10g数据库下的 XDB组件的重新安装
emmmm,这是一个不做死就不会的过程!!! 今天在导出数据库时,遇到了报错信息,其实开发说这个报错没关系了,但作死如楼主,一定要把这个错给解决了,然后就有了下面的作死过程. 错误关键字是:packa ...
- 挂载U盘和移动硬盘
1, 挂载U盘和USB接口的移动硬盘一样对linux系统而言U盘也是当作SCSI设备对待的.使用方法和移动硬盘完全一样.插入U盘之前[root at pldyrouter root]# fdisk - ...
- Cloudera Manager及CDH最新版本安装全程记录
大家都知道,Apache Hadoop的配置很繁琐,而且很零散,为此Cloudera公司提供了Clouder Manager工具,而且还封装了Apache Hadoop,flume,spark,hiv ...
- git将文件托管到github上遇到的问题
先来一问题描述: 执行:$ git push -u origin master 结果Warning: Permanently added the RSA host key for IP address ...
- Jquery入门(初学者易懂)
一.定义 jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架).jQuery设计的宗旨是"w ...
- [Luogu 1402] 酒店之王
题目 Description XX酒店的老板想成为酒店之王,本着这种希望,第一步要将酒店变得人性化.由于很多来住店的旅客有自己喜好的房间色调.阳光等,也有自己所爱的菜,但是该酒店只有p间房间,一天只有 ...