/// <summary>
/// Waits for an asynchronous call to the _NAME_ service to complete.
/// </summary>
    public virtual _NAME_ResponseMessage End_NAME_(IAsyncResult ar)
    {
        try
        {
            IServiceResponse response = ProcessRequestAsyncResult.WaitForComplete(ar, true);
            OnResponseSent(response);
            return(new _NAME_ResponseMessage((_NAME_Response)response));
        }
        catch (Exception e)
        {
            Exception fault = CreateSoapFault(ProcessRequestAsyncResult.GetRequest(ar), e);
            OnResponseFaultSent(fault);
            throw fault;
        }
    }
示例#2
0
        /// <summary>
        /// Dispatches an incoming binary encoded request.
        /// </summary>
        /// <param name="ar">The ar.</param>
        /// <returns></returns>
        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);
            }
        }