How to use the ebMS 3.0 MessageDecoder

by david 2. August 2010 09:20

Here is some example code for the simple MessageDecoder class that I wrote for my last blog, it takes an example ebMS 3.0 soap document from a file and loads it - giving access to the UserMessage and SignalMessage elements inside the envelope header.  I have tried it on all the examples that I extracted from the eMS 3.0 core spec and it seems to work OK. It's just a start...

using System;
using System.IO; 
using ebMS3.Soap;

namespace SoapLoaderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string filename = "example.xml";
            FileStream file = new FileStream(filename, FileMode.Open,
                FileAccess.Read);
            ebMS3.Soap.MessageDecoder decoder = new MessageDecoder(file);
            SignalMessage[] smsgs = decoder.GetHeaderSignalMessages();
            UserMessage[] umsgs = decoder.GetHeaderUserMessages();
            file.Close();
        }
    }
}

About the author

David

I'm a C# developer having worked with .Net since it was in beta.  Before that I mainly worked in C and C++.  I have been developing commercial software for more than 20 years.  I also mess around with microprocesors, but that's just for fun.  I live near Cambridge, England and at the moment I'm contracted to one of the departments at Cambridge University.

Related Links

Tag cloud