posts - 139, comments - 35, trackbacks - 1, articles - 0

接收RawString类型的消息

Posted on 2008-06-02 10:49 鸡尾虾的壳 阅读(18) 评论(0)  编辑 收藏 所属分类: Biztalk Server
方法一:
1.在Orchestration的Receive Shape处设置RawStrings为消息类型
2.在Receive Pipeline的Validate Stage处使用ContextAdder组件,设置属性Key: MessageType; Namespace:http://schemas.microsoft.com/Biztalk/2003/system-properties; Promote:True; Value: five-part assembly-qualified type name
3.在Orchestration中,使用ToString( )方法得到消息字符串。

方法二:
1.在Orchestration处,接收XMLDocument类型的消息,使用PassThruReceive管道。
2.构造一个Multi-Part消息,其中一个类型为RawStrings,并用接收到的消息进行构造。
3.定义一个RawStrings类型的变量,把RawStrings类型的MessagePart assign给它,这样调用变量的ToString( )方法就可以得到潜在的消息字符串了。

方法三:类同方法二但是不需要构造Multi-Part Message
public BinaryMessage(XLANGMessage doc)
{
Stream stream = (Stream)doc[0].RetrieveAs(typeof(Stream));
using (stream)
{
MemoryStream tempStream = new MemoryStream();
byte[] buffer = new byte[64*1024];
int bytesRead = 0;
while ( (bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0 )
tempStream.Write(buffer, 0, bytesRead);
Contents = tempStream.ToArray();
}
}


http://www.traceofthought.net/PermaLink,guid,c5418f3d-2ea7-4530-ab9c-ae4c49154fcb.aspx


标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2008-06-02 10:57 编辑过


相关链接: