Opc.Ua.EndpointBase.EndInvokeService C# (CSharp) Method

EndInvokeService() public method

Dispatches an incoming binary encoded request.
public EndInvokeService ( IAsyncResult ar ) : InvokeServiceResponseMessage
ar IAsyncResult The ar.
return InvokeServiceResponseMessage
        public virtual InvokeServiceResponseMessage EndInvokeService(IAsyncResult ar)
        {
            try
            {
                // wait for the response.
                IServiceResponse response = ProcessRequestAsyncResult.WaitForComplete(ar, false);

                // encode the repsonse.
                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(response, MessageContext);
                return outgoing;
            }
            catch (Exception e)
            {
                // create fault.
                ServiceFault fault = CreateFault(ProcessRequestAsyncResult.GetRequest(ar), e);

                // encode the fault as a response.
                InvokeServiceResponseMessage outgoing = new InvokeServiceResponseMessage();
                outgoing.InvokeServiceResponse = BinaryEncoder.EncodeMessage(fault, MessageContext);
                return outgoing;
            }
        }
        #endif