コード例 #1
0
        /// <summary>
        /// The client side implementation of the BeginInvokeService service contract.
        /// </summary>
        public override IAsyncResult BeginInvokeService(InvokeServiceMessage request, AsyncCallback callback, object asyncState)
        {
            WcfChannelAsyncResult asyncResult = new WcfChannelAsyncResult(m_channel, callback, asyncState);

            lock (asyncResult.Lock)
            {
                asyncResult.InnerResult = asyncResult.Channel.BeginInvokeService(request, asyncResult.OnOperationCompleted, null);
            }

            return(asyncResult);
        }
コード例 #2
0
        /// <summary>
        /// The client side implementation of the InvokeService service contract.
        /// </summary>
        public override InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request)
        {
            IAsyncResult result = null;

            lock (this.Channel)
            {
                result = this.Channel.BeginInvokeService(request, null, null);
            }

            return(this.Channel.EndInvokeService(result));
        }
コード例 #3
0
        /// <summary>
        /// Dispatches an incoming binary encoded request.
        /// </summary>
        /// <param name="request">Request.</param>
        /// <returns>Invoke service response message.</returns>
        public virtual InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request)
        {
            IServiceRequest  decodedRequest = null;
            IServiceResponse response       = null;

            // create context for request and reply.
            ServiceMessageContext context = MessageContext;

            try
            {
                // check for null.
                if (request == null || request.InvokeServiceRequest == null)
                {
                    throw new ServiceResultException(StatusCodes.BadDecodingError, Utils.Format("Null message cannot be processed."));
                }

                // decoding incoming message.
                decodedRequest =
                    BinaryDecoder.DecodeMessage(request.InvokeServiceRequest, null, context) as IServiceRequest;

                // invoke service.
                response = ProcessRequest(decodedRequest);

                // encode response.
                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(response, context);
                return(outgoing);
            }
            catch (Exception e)
            {
                // create fault.
                ServiceFault fault = CreateFault(decodedRequest, e);

                // encode fault response.
                if (context == null)
                {
                    context = new ServiceMessageContext();
                }

                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(fault, context);
                return(outgoing);
            }
        }
コード例 #4
0
        /// <summary>
        /// Dispatches an incoming binary encoded request.
        /// </summary>
        public virtual IAsyncResult BeginInvokeService(InvokeServiceMessage message, AsyncCallback callack,
                                                       object callbackData)
        {
            try {
                // check for bad data.
                if (message == null)
                {
                    throw new ServiceResultException(StatusCodes.BadInvalidArgument);
                }

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

                // create handler.
                ProcessRequestAsyncResult result = new ProcessRequestAsyncResult(this, callack, callbackData, 0);
                return(result.BeginProcessRequest(SecureChannelContext.Current, message.InvokeServiceRequest));
            } catch (Exception e) {
                throw CreateSoapFault(null, e);
            }
        }
コード例 #5
0
        /// <summary>
        /// Dispatches an incoming binary encoded request.
        /// </summary>
        public virtual IAsyncResult BeginInvokeService(InvokeServiceMessage message, AsyncCallback callack, object callbackData)
        {
            try
            {
                // check for bad data.
                if (message == null)
                {
                    throw new ServiceResultException(StatusCodes.BadInvalidArgument);
                }
                
                // set the request context.
                SetRequestContext(RequestEncoding.Binary);

                // create handler.
                ProcessRequestAsyncResult result = new ProcessRequestAsyncResult(this, callack, callbackData, 0);
                return result.BeginProcessRequest(SecureChannelContext.Current, message.InvokeServiceRequest);
            }
            catch (Exception e)
            {
                throw CreateSoapFault(null, e);
            }
        }
コード例 #6
0
        /// <summary>
        /// Dispatches an incoming binary encoded request.
        /// </summary>
        /// <param name="request">Request.</param>
        /// <returns>Invoke service response message.</returns>
        public virtual InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request)
        {          
            IServiceRequest decodedRequest = null;
            IServiceResponse  response = null;          
            
            // create context for request and reply.
            ServiceMessageContext context = MessageContext;
            
            try
            {
                // check for null.
                if (request == null || request.InvokeServiceRequest == null)
                {
                    throw new ServiceResultException(StatusCodes.BadDecodingError, Utils.Format("Null message cannot be processed."));
                }
                
                // decoding incoming message.
                decodedRequest = BinaryDecoder.DecodeMessage(request.InvokeServiceRequest, null, context) as IServiceRequest;

                // invoke service.
                response = ProcessRequest(decodedRequest);
                
                // encode response.
                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(response, context);
                return outgoing;
            }
            catch (Exception e)
            {
                // create fault.
                ServiceFault fault = CreateFault(decodedRequest, e);
                
                // encode fault response.
                if (context == null)
                {
                    context = new ServiceMessageContext();
                }

                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(fault, context);
                return outgoing;
            }
        }
コード例 #7
0
 /// <summary>
 /// The client side implementation of the BeginInvokeService service contract.
 /// </summary>
 public abstract IAsyncResult BeginInvokeService(InvokeServiceMessage request, AsyncCallback callback, object asyncState);
コード例 #8
0
 /// <summary>
 /// The client side implementation of the InvokeService service contract.
 /// </summary>
 public abstract InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request);
コード例 #9
0
 /// <summary>
 /// The client side implementation of the BeginInvokeService service contract.
 /// </summary>
 public abstract IAsyncResult BeginInvokeService(InvokeServiceMessage request, AsyncCallback callback, object asyncState);
コード例 #10
0
 /// <summary>
 /// The client side implementation of the InvokeService service contract.
 /// </summary>
 public abstract InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request);
コード例 #11
0
ファイル: MyServer.cs プロジェクト: yuriik83/UA-.NET
 public InvokeServiceResponseMessage InvokeService(InvokeServiceMessage request)
 {
     throw new NotImplementedException();
 }