Inheritance: IServiceMessage
Exemplo n.º 1
0
        /// <summary>
        /// Asynchronously calls the Read service.
        /// </summary>
        public virtual IAsyncResult BeginRead(ReadMessage message, AsyncCallback callback, object callbackData)
        {
            try
            {
                // check for bad data.
                if (message == null) throw new ArgumentNullException("message");

                // set the request context.
                SetRequestContext(RequestEncoding.Xml);

                // create handler.
                ProcessRequestAsyncResult result = new ProcessRequestAsyncResult(this, callback, callbackData, 0);
                return result.BeginProcessRequest(SecureChannelContext.Current, message.ReadRequest);
            }
            catch (Exception e)
            {
                throw CreateSoapFault(message.ReadRequest, e);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The operation contract for the Read service.
        /// </summary>
        public virtual ReadResponseMessage Read(ReadMessage request)
        {
            ReadResponse response = null;

            try
            {
                // OnRequestReceived(message.ReadRequest);

                SetRequestContext(RequestEncoding.Xml);
                response = (ReadResponse)Read(request.ReadRequest);
                // OnResponseSent(response);
                return new ReadResponseMessage(response);
            }
            catch (Exception e)
            {
                Exception fault = CreateSoapFault(request.ReadRequest, e);
                // OnResponseFaultSent(fault);
                throw fault;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// The operation contract for the Read service.
 /// </summary>
 public virtual ReadResponseMessage Read(ReadMessage request)
 {
     try
     {
         SetRequestContext(RequestEncoding.Xml);
         ReadResponse response = (ReadResponse)Read(request.ReadRequest);
         return new ReadResponseMessage(response);
     }
     catch (Exception e)
     {
         throw CreateSoapFault(request.ReadRequest, e);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Reads the values for one or more attributes.
        /// </summary>
        public ReadResponseMessage Read(ReadMessage request)
        {
            try
            {
                lock (m_lock)
                {
                    // verify that the session is still valid. 
                    VerifySession(request.RequestHeader, false);

                    // process each attribute.
                    ListOfDataValue results = new ListOfDataValue();
                    ListOfDiagnosticInfo diagnosticInfos = new ListOfDiagnosticInfo();

                    for (int ii = 0; ii < request.NodesToRead.Count; ii++)
                    {
                        DataValue result = new DataValue();
                        DiagnosticInfo diagnosticInfo = new DiagnosticInfo();

                        m_nodeManager.Read(
                            request.NodesToRead[ii],
                            result,
                            diagnosticInfo);

                        results.Add(result);
                        diagnosticInfos.Add(diagnosticInfo);
                    }

                    // return the response.
                    ReadResponseMessage response = new ReadResponseMessage();

                    response.ResponseHeader = CreateResponseHeader(request.RequestHeader);
                    response.Results = results;
                    response.DiagnosticInfos = diagnosticInfos;

                    return response;
                }
            }
            catch (Exception e)
            {
                throw CreateSoapFault(request.RequestHeader, e);
            }
        }