[BizTalk]让BizTalk消息中携带附件.

Use System.Xml.XmlDocument as the part type for the message, this is treated
as a generic stream of data.  Then you can use a stream of data for this
part.

实现这样一个功能:
1.访问SQL Reporting Service得到一个报表的数据
2.将报表数(stream)赋给BizTalk中的一个消息中。

使用System.Xml.XmlDocume数据类型.
代码如下:

public static void CreateReportPart(XLANGMessage msg, int partIndex, string 
reportName)

{

System.IO.Stream reportStream 
= ReportServicesProxy.GetReport(reportName);
ReportStreamFactory factory 
= new ReportStreamFactory(reportStream);
msg[partIndex].LoadFrom(factory);

}


public class ReportStreamFactory : IStreamFactory
{
System.IO.Stream _stream;
public ReportStreamFactory(System.IO.Stream stream)
{_stream = stream;}
public System.IO.Stream CreateStream()
{return _stream;}

public void Dispose()
{_stream.Close();}

}



通过类似这样的方案,就可以将附件添加到消息中了

posted on 2005-09-13 22:08  徐中  阅读(641)  评论(0编辑  收藏  举报

导航