• Авторизация


Going binary with BizTalk 25-07-2004 21:55 к комментариям - к полной версии - понравилось!


When you want to create new message programmatically within an orchestration, you'd normally assign an XmlDocument object to your message. However: did you ever wonder how you could create non-XML messages within BizTalk Server orchestrations? (Assigning an XmlDocument would clearly not work here :-) )

For all of you "bitheads", here it is :

Option Explicit On
Option Strict On
Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.XLANGs.BaseTypes

Namespace CLAESSENS.BTS2004.SAMPLES
_
Public Class MyStreamFactory
Implements Microsoft.XLANGs.BaseTypes.IStreamFactory
Private m_mystringdata As String = ""
Public Sub New(ByVal stringdata As String)
m_mystringdata = stringdata
End Sub
Public Overridable Function CreateStream() As System.IO.Stream _
Implements Microsoft.XLANGs.BaseTypes.IStreamFactory.CreateStream
return New IO.MemoryStream( _
System.Text.ASCIIEncoding.ASCII.GetBytes(m_mystringdata ))

End Function
End Class
_
Public Class MyMessageCreator

Public Sub CreateMyMessage(ByVal mydestmsg As XLANGMessage)
mydestmsg(0).LoadFrom(New MyStreamFactory("this is my data to create message from"))
End Sub
End Class
End Namespace
The trick here is in the IStreamFactory. BizTalk Server is able to create messages from such a factory class. In this example, I've just created a 'binary' message from a string, using ASCII encoding. However: you could just as well assign something like a .PDF file or image to your message if you want.
No limits! BizTalk Server rocks!

вверх^ к полной версии понравилось! в evernote


Вы сейчас не можете прокомментировать это сообщение.

Дневник Going binary with BizTalk | Oleg_Kleiman - Soft kibitzing | Лента друзей Oleg_Kleiman / Полная версия Добавить в друзья Страницы: раньше»