public SerializeIntegrationTypeConnector(IMessageSerializer messageSerializer, MessageMetadataRegistry messageMetadataRegistry, Type[] handledTypes)
 {
     this.messageSerializer       = messageSerializer;
     this.messageMetadataRegistry = messageMetadataRegistry;
     this.handledTypes            = handledTypes;
     systemXmlMessageSerializer   = new SystemXmlMessageSerializer();
 }
        private object[] DeserializeXML(string message, Type[] types)
        {
            var ser = new SystemXmlMessageSerializer();

            using (var stream = new MemoryStream())
            {
                var bytes = Encoding.UTF8.GetBytes(message.ToCharArray());
                stream.Write(bytes, 0, bytes.Length);
                stream.Seek(0, SeekOrigin.Begin);
                stream.Flush();
                return(ser.Deserialize(stream, types));
            }
        }
        private static string SerializeMessages(object[] messages, bool skipWrappingElementForSingleMessages)
        {
            string s;
            var    ser = new SystemXmlMessageSerializer {
                SkipWrappingElementForSingleMessages = skipWrappingElementForSingleMessages
            };

            using (var stream = new MemoryStream())
            {
                ser.Serialize(messages, stream);
                stream.Flush();
                stream.Seek(0, SeekOrigin.Begin);
                using (var streamReader = new StreamReader(stream))
                {
                    s = streamReader.ReadToEnd();
                }
            }
            return(s);
        }