public virtual downloadDataResponse downloadData(downloadDataRequest request)
        {
            try
            {
                byte[] data = RandomBuffer(request.Size);

                downloadDataResponse dataResponse = new downloadDataResponse(data);

                return dataResponse;
            }
            catch (Exception e)
            {
                Debug.WriteLine("Server exception: " + e.ToString());

                throw;
            }
        }
예제 #2
0
        public downloadDataResponse downloadData(downloadDataRequest request)
        {
            Common.CustomTextTraceSource ts = new Common.CustomTextTraceSource("WebServiceConsumer.WebServiceConsumer.downloadData",
                   "MyTraceSource", SourceLevels.Information);

            ICommercialVehicleCollisionPortTypeChannel channel = GetClientProxyChannel();

            try
            {
                downloadDataResponse resp = channel.downloadData(request);

                channel.Close();

                return resp;
            }
            catch (FaultException)
            {
                channel.Abort();
                throw;
            }
            catch (CommunicationException)
            {
                channel.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                channel.Abort();
                throw;
            }
            catch (Exception e)
            {
                ts.TraceInformation("Exception: " + e.Message);
                if (e.InnerException != null)
                {
                    ts.TraceInformation("InnerException: " + e.InnerException.Message);
                }

                channel.Abort();

                throw;
            }
        }