コード例 #1
0
        public getDocumentResponse getDocument(getDocumentRequest request)
        {

            Common.CustomTextTraceSource ts = new Common.CustomTextTraceSource("WebServiceConsumer.WebServiceConsumer.getDocument",
                "MyTraceSource", SourceLevels.Information);

            ICommercialVehicleCollisionPortTypeChannel channel = GetClientProxyChannel();
            try
            {            
                // Use the 'client' variable to call operations on the service.
                getDocumentResponse resp = channel.getDocument(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;
            }
        }
コード例 #2
0
        public virtual getDocumentResponse getDocument(getDocumentRequest request)
        {
            try
            {
                CommercialVehicleCollisionDocumentType doc = new CommercialVehicleCollisionDocumentType();

                doc.DocumentFileControlID = "12348765";
               
                doc.IncidentText = "Speeding Ticket";

                List<string> vins = new List<string>();

                vins.Add("VIN # 97651234");
                vins.Add("VIN # 87651234");
                vins.Add("VIN # 77651234");
                doc.InvolvedVehicleVIN = vins.ToArray();

                getDocumentResponse docResponse = new getDocumentResponse(doc);

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

                throw;
            }
        }