Ejemplo n.º 1
0
 public XmlRpcMessage(string methodName, XmlDictionaryReader paramsSection) : this()
 {
     _bodyReader = paramsSection;
     _bodyReader.MoveToContent();
     _isFault = false;
     _properties.Add("XmlRpcMethodName", methodName);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called by the base adapter class's Connect() method. This should contain all application specific validation
        /// logic and initialization of resources used by the custom adapter.
        /// if an exception is thrown, it will be caught by the runtime and the adapter will fail to start up. It will appear as
        /// error in the Neuron ESB Event log and will be in a stopped state within Endpoint Health.
        /// </summary>
        private void ConnectAdapter()
        {
            // SAMPLE:  Validation logic for basic properties should be done here
            // ***********************************
            if (System.Convert.ToInt32(BaudRate) < 0)
            {
                throw new ArgumentOutOfRangeException("Baud Rate", "You must enter a valid BaudRate number (greater than zero)");
            }
            if (string.IsNullOrEmpty(COMPort))
            {
                throw new ArgumentNullException("SerialPort", "You must enter the name of COM port to connect to");
            }
            if (string.IsNullOrEmpty(BaudRate))
            {
                throw new ArgumentNullException("Baud Rate", "The BaudRate cannot be null.");
            }


            // SAMPLE: Custom set metadata properties that will be provided with every message sent or received from Neuron
            // The IncludeMetadata flag is set by the "Include Metadata Properties" checkbox located on the General tab of an
            // Adapter Endpoint within the Neuron ESB Explorer.
            // ***********************************
            if (IncludeMetadata)
            {
                MessageProperties.Add(new NameValuePair("SerialPort", COMPort));
                MessageProperties.Add(new NameValuePair("BaudRate", BaudRate));
            }
        }
Ejemplo n.º 3
0
 public XmlRpcMessage(string methodName)
     : this()
 {
     bodyReader = null;
     isFault    = false;
     properties.Add("XmlRpcMethodName", methodName);
 }
        public void AddTo(MessageProperties properties)
        {
            if (properties == null)
            {
                throw FxTrace.Exception.ArgumentNull("properties");
            }

            properties.Add(NetworkInterfaceMessageProperty.Name, this);
        }
 public void AddTo(MessageProperties properties)
 {
     this.ThrowIfDisposed();
     if (properties == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("properties");
     }
     properties.Add(Name, this);
 }
        internal static void AddTo(this ChannelBindingMessageProperty channelBindingProperty, MessageProperties properties)
        {
            // Throws if disposed
            System.Security.Authentication.ExtendedProtection.ChannelBinding dummy = channelBindingProperty.ChannelBinding;
            if (properties == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(properties));
            }

            properties.Add(ChannelBindingMessageProperty.Name, channelBindingProperty);
        }
Ejemplo n.º 7
0
        internal static void AddTo(this ChannelBindingMessageProperty channelBindingProperty, MessageProperties properties)
        {
            // Throws if disposed
            var dummy = channelBindingProperty.ChannelBinding;

            if (properties == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("properties");
            }

            properties.Add(ChannelBindingMessageProperty.Name, channelBindingProperty);
        }
Ejemplo n.º 8
0
		public void CopyProperties ()
		{
			var mp = new MessageProperties ();
			var obj = new object ();
			var obj2 = new object ();
			mp.Add ("FooProperty", obj);
			var mp2 = new MessageProperties ();
			mp2.Add ("BarProperty", obj2);
			mp.CopyProperties (mp2);
			Assert.AreEqual (obj, mp ["FooProperty"], "#1");
			Assert.AreEqual (obj2, mp ["BarProperty"], "#2");
		}
Ejemplo n.º 9
0
        public void CopyProperties()
        {
            var mp   = new MessageProperties();
            var obj  = new object();
            var obj2 = new object();

            mp.Add("FooProperty", obj);
            var mp2 = new MessageProperties();

            mp2.Add("BarProperty", obj2);
            mp.CopyProperties(mp2);
            Assert.AreEqual(obj, mp ["FooProperty"], "#1");
            Assert.AreEqual(obj2, mp ["BarProperty"], "#2");
        }
Ejemplo n.º 10
0
        private void AddPropertiesToMessageCore(Message message, MessageDescription messageDescription, object[] parameters)
        {
            MessageProperties properties = message.Properties;
            MessagePropertyDescriptionCollection propertyDescriptions = messageDescription.Properties;

            for (int i = 0; i < propertyDescriptions.Count; i++)
            {
                MessagePropertyDescription propertyDescription = propertyDescriptions[i];
                object parameter = parameters[propertyDescription.Index];
                if (null != parameter)
                {
                    properties.Add(propertyDescription.Name, parameter);
                }
            }
        }
Ejemplo n.º 11
0
        private void AddPropertiesToMessageCore(Message message, MessageDescription messageDescription, object[] parameters)
        {
            MessageProperties properties = message.Properties;
            MessagePropertyDescriptionCollection descriptions = messageDescription.Properties;

            for (int i = 0; i < descriptions.Count; i++)
            {
                MessagePropertyDescription description = descriptions[i];
                object property = parameters[description.Index];
                if (property != null)
                {
                    properties.Add(description.Name, property);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Changes a HTTP GET into a POST.
        /// </summary>
        /// <param name="properties">Properties for which the HTTP method is to be changed.</param>
        public static void MakeHttpPOSTMethod(MessageProperties properties)
        {
            object property;
            HttpRequestMessageProperty httpMessageProperty = null;

            if (properties.TryGetValue(MessageUtility.HttpRequestName, out property))
            {
                httpMessageProperty = property as HttpRequestMessageProperty;
            }

            if (httpMessageProperty == null)
            {
                httpMessageProperty = new HttpRequestMessageProperty();
                properties.Add(MessageUtility.HttpRequestName, httpMessageProperty);
            }

            httpMessageProperty.Method             = MessageUtility.HttpPostMethodName;
            httpMessageProperty.SuppressEntityBody = false;
        }
        /// <summary>
        /// Changes a HTTP GET into a POST.
        /// </summary>
        /// <param name="properties">Properties for which the HTTP method is to be changed.</param>
        public static void MakeHttpPOSTMethod(MessageProperties properties)
        {
            object property;
            HttpRequestMessageProperty httpMessageProperty = null;

            if (properties.TryGetValue(MessageUtility.HttpRequestName, out property))
            {
                httpMessageProperty = property as HttpRequestMessageProperty;
            }

            if (httpMessageProperty == null)
            {
                httpMessageProperty = new HttpRequestMessageProperty();
                properties.Add(MessageUtility.HttpRequestName, httpMessageProperty);
            }

            httpMessageProperty.Method = MessageUtility.HttpPostMethodName;
            httpMessageProperty.SuppressEntityBody = false;
        }