Ejemplo n.º 1
0
        private void SubmitDiagnosticsResult(UserDetail userDetail, HttpPostedFileBase file, FormInformation info)
        {
            try
            {
                var dbxlTemplateName = ApplicationConstants.ScanDiagnosticsConstant.ScanDiagnosticsTemplateName;
                var dbxlUrl          = ApplicationConstants.ScanDiagnosticsConstant.ScanDiagnosticsDbxlUrl;
                var dbxlUserName     = ApplicationConstants.ScanDiagnosticsConstant.ScanDiagnosticsDbxlUserName;
                var dbxlPassword     = ApplicationConstants.ScanDiagnosticsConstant.ScanDiagnosticsDbxlPassword;

                if (!String.IsNullOrWhiteSpace(dbxlTemplateName) &&
                    !String.IsNullOrWhiteSpace(dbxlUrl) &&
                    !String.IsNullOrWhiteSpace(dbxlUserName) &&
                    !String.IsNullOrWhiteSpace(dbxlPassword))
                {
                    var scanTemplateXml = GetQdScanTemplateXml(info, userDetail);

                    var submitDocument = new SubmitDocument
                    {
                        docTypeName = dbxlTemplateName,
                        xml         = scanTemplateXml,
                        name        = file.FileName,
                        author      = userDetail.UserName
                    };
                    var submitDocumentXml = GetSerializedXml <SubmitDocument>(submitDocument);

                    dbxlUrl = String.Format("{0}{1}qdabrawebservice/DbxlDocumentService.asmx", dbxlUrl, dbxlUrl.EndsWith("/") ? string.Empty : "/");

                    SoapHelper.CallSoapService(new SoapServiceRequest
                    {
                        data              = submitDocumentXml,
                        overrideAction    = false,
                        soapServiceAction = "http://qdabra.com/webservices/SubmitDocument",
                        url       = dbxlUrl,
                        useCookie = false
                    },
                                               new NetworkCredential(dbxlUserName, dbxlPassword));
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        private ActionResult InternalCallSoapService(SoapServiceRequest request)
        {
            // TODO: Add SSO handling

            SoapResult result = new SoapResult();

            try
            {
                // 2017/03/02 -- Move the code to SoapHelper.
                var uploadResult = SoapHelper.CallSoapService(request, GetCredentials(request.url));

                result.resultBody = GetBodyFromSoapResult(uploadResult);
                result.success    = true;
            }
            catch (WebException ex)
            {
                if (ex.Response == null)
                {
                    result.message = String.Format("The request to the service failed with an error: {0}", ex.Message);
                }
                else
                {
                    var fault = GetSoapFault(ex);
                    result.fault = fault;

                    result.message = !String.IsNullOrWhiteSpace(fault.faultstring)
                        ? String.Format("The service failed with an error: {0}", fault.faultstring)
                        : String.Format("The request failed with status {0}", fault.faultcode);
                }
            }
            catch (Exception ex)
            {
                result.message = String.Format("The request to the service failed with an error: {0}", ex.Message);
            }
            return(new ObjectResult <SoapResult>(result));
        }