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