日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

AssemblyExecuteAdapter

發(fā)布時(shí)間:2025/3/18 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AssemblyExecuteAdapter 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

BizTalk custom adapter

AssemblyExecuteAdapter

功能

更為方便的擴(kuò)展BizTalk custom adapter 的交互方式,只需要實(shí)現(xiàn)IAssemblyExecute 接口就可以讓BizTalk AssemblyExecuteAdapter 執(zhí)行需要的業(yè)務(wù)邏輯。

代碼

AssemblyExecuteAdapterTransmitterEndpoint.cs

通過(guò)配置需要加載的dll 文件來(lái)執(zhí)行dll 內(nèi)部處理邏輯

?

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;

}

?

?

配置

配置發(fā)送端口

配置參數(shù)

?

Assembly qualified name:實(shí)現(xiàn)了IAssemblyExecute接口的dll文件

Function Name: 這個(gè)adapter的功能名稱(chēng),確保唯一

Input Parameter Xml: 執(zhí)行ExecuteResponse需要的參數(shù)以XML的形式提供

Save Error Message Path:保存錯(cuò)誤報(bào)文的路徑

Save Response Message Path:保存執(zhí)行ExecuteResponse方法返回的結(jié)果

選擇實(shí)現(xiàn)了IAssemblyExecute 接口的dll文件

編輯輸入?yún)?shù)

?

轉(zhuǎn)載于:https://www.cnblogs.com/neozhu/p/7877802.html

總結(jié)

以上是生活随笔為你收集整理的AssemblyExecuteAdapter的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。