Binary message creation in BizTalk Server

From: Christof ("Christof")
Date: 05/01/04

  • Next message: Christof: "Re: Module 1 - HAT / Query Trouble"
    Date: Sat, 1 May 2004 22:34:39 +0200
    
    

    Ok Arun... let' s go :-)))

    - Define your XML schema
    - Deploy it
    - Setup a new orchestration and drop a rcv shape and port in there in order
    to receive your input message
    - Iterate through each of the vendors in your inbound XML message
    - Create .NET class like you see in "snippet 1" below. Doing this will
    allow you to load binary messages like pdf etc into your orchestration.
    - For each iteration, please do following:
        - construct a BizTalk Server Orchestration Message of type
    "System.Xml.XmlDocument"
        - initialise it by calling the MyMessageCreator.CreateMyMessage in a
    "construct message" shape, give the message as parameter
        - drop a send shape
        - connect it to a dynamic send port
        - set the destination of the send port in an expression shape (like
    this: ftp://myserver/mydirectory/myfilename.pdf)
        - assign the FTP username and password to use in the construct message
    shape, like you can see in snippet 2 below.

    Hope this helps!
    Best regards,

    Christof

    ========= snippet 1 ===============
    Option Explicit On
    Option Strict On

    Imports System
    Imports System.Runtime.InteropServices
    Imports Microsoft.XLANGs.BaseTypes

    Namespace CLAESSENS.BTS2004.SAMPLES
         <Serializable()> _
        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

         <Serializable()> _
        Public Class MyMessageCreator

                Public Sub CreateMyMessage(ByVal mydestmsg As XLANGMessage)
                               mydestmsg(0).LoadFrom(New MyStreamFactory("this
    is my binary test data to construct message from"))
                End Sub

         End Class
    End Namespace
    ===============================

    ========= snippet 2 ===============
    //configure your dynamic FTP port:
    orchprtSndMyMessagePort(Microsoft.XLANGs.BaseTypes.Address) =
    ftp://myserver/mydirectory/myfilename.xml;

    //set context on the message you want to send:
    msgMyMessage(FTP.UserName) = "myFTPUsername";
    msgMyMessage(FTP.Password) = "myFTPPassword";
    msgMyMessage(BTS.RetryCount) = 20;
    msgMyMessage(BTS.RetryInterval) = 2;
    ===============================

    "Arun" <anonymous@discussions.microsoft.com> wrote in message
    news:137EDBDB-8C10-439D-A1F5-4052C48CD8BE@microsoft.com...
    > Hi All
    >
    > I would like to distribute non-XML files to different vendors using BTS
    2004 FTP Adapter
    > My vendor names would be part of my input XML message
    >
    > I would iterate through XML message and get the vendor list and pick up
    the Non-XML files (such as .doc, .pdf, .xls etc.,)
    > from a pre-defined location (location also will be part of input message)
    and ftp these files along with input XML to
    > different locations.


  • Next message: Christof: "Re: Module 1 - HAT / Query Trouble"

    Relevant Pages

    • Re: How to use BTS.EncryptionCert
      ... somewhere in your orchestration you have to determine to whom the ... dynamic send port address and the context properties of the outbound message. ... several receivers using a dynamic ftp send port. ...
      (microsoft.public.biztalk.general)
    • Re: BAM Question
      ... On a receive port (not orchestration) i need to collect a few things ... I get this information out of the xml message of course. ... In the pivot table, drag measure into the area labeled "Drop Data ... In the Tracking Profile Editor, select the Receive port shape from your ...
      (microsoft.public.biztalk.general)
    • RE: FTP Adapter questions
      ... You can easily use a send pr receive port that is configuraed to use FTP ... you can not specify this at ... >>notice that when I add a port in the orchestration designer, ...
      (microsoft.public.biztalk.general)
    • BTS 2004 File Truncation Problem
      ... I FTP a 160 mb file (XML document) from the mainframe to the ... FTP server. ... The file is then treated as a passthru from an FTP receive ... port location. ...
      (microsoft.public.biztalk.general)
    • How to use BTS.EncryptionCert
      ... I am about to reconstruct my orchestration to deliver a message to ... several receivers using a dynamic ftp send port. ... Because we are building a ftp address, the file names and so on ...
      (microsoft.public.biztalk.general)