Friday, 24 May 2013

Create XLANG Message using C# component.

Code to create XLANG Message inside Biztalk Orchestration

 [Serializable]
    public class MyStreamFactory : Microsoft.XLANGs.BaseTypes.IStreamFactory
    {
        private string m_mystringdata;

        public MyStreamFactory(string stringdata)
        {
            m_mystringdata = stringdata;
        }


        public System.IO.Stream CreateStream()
        {
            return new System.IO.MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(m_mystringdata));
        }
    }

    [Serializable]
    public class MyMessageCreator
    {
        public void CreateMyMessage(Microsoft.XLANGs.BaseTypes.XLANGMessage mydestmsg)
        {
            mydestmsg[0].LoadFrom(new MyStreamFactory("this is my data to create message from"));
        }
    }

This code can be used to create non xml message (Like PDF, Docx ) inside orchestration.

No comments:

Post a Comment