public static string GetDownloadFileMessage(X509Certificate2 certificate, string customerId, string fileType, string targetId, Environment environment, int requestId, Status status, string fileReference)
        {
            var timestamp = DateTime.Now;

            var soapBodyContent = Helper.GetDownloadFileRequest(
                customerId: customerId,
                timestamp: timestamp,
                environment: environment,
                softwareId: SoftwareId,
                requestId: requestId,
                status: status,
                fileType: fileType,
                targetId: targetId,
                fileReference: fileReference,
                certificate: certificate,
                namespaces: Namespaces);

            var soapRequestDocument = Helper.GetSoapRequestXmlDocument(certificate, soapBodyContent, timestamp, Namespaces);

            return(soapRequestDocument.OuterXml);
        }
Example #2
0
        // Builds SOAP request body for downloading a file
        public static XElement GetDownloadFileRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, int requestId, string fileReference, string fileType, string targetId, X509Certificate2 certificate, Status status, Dictionary <string, XNamespace> namespaces)
        {
            var applicationRequest = GetFileApplicationRequest(customerId, timestamp, environment, softwareId, fileReference, fileType, targetId, status, namespaces);
            var requestBase64      = SignApplicationRequestAndReturnAsBase64(applicationRequest, certificate);
            var requestHeader      = GetRequestHeader(customerId, requestId, timestamp, softwareId, namespaces);

            return(new XElement(namespaces["cor"] + "downloadFilein",
                                requestHeader,
                                new XElement(namespaces["mod"] + "ApplicationRequest", requestBase64)));
        }
Example #3
0
 // Creates application request for getting a file
 private static XElement GetFileApplicationRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, string fileReference, string fileType, string targetId, Status status, Dictionary <string, XNamespace> namespaces)
 {
     return(new XElement(namespaces["bxd"] + "ApplicationRequest",
                         new XElement(namespaces["bxd"] + "CustomerId", customerId),
                         new XElement(namespaces["bxd"] + "Command", "DownloadFile"),
                         new XElement(namespaces["bxd"] + "Timestamp", timestamp),
                         new XElement(namespaces["bxd"] + "Status", status.ToString()),
                         new XElement(namespaces["bxd"] + "Environment", environment.ToString()),
                         new XElement(namespaces["bxd"] + "FileReferences",
                                      new XElement(namespaces["bxd"] + "FileReference", fileReference)),
                         new XElement(namespaces["bxd"] + "TargetId", targetId),
                         new XElement(namespaces["bxd"] + "Compression", true),
                         new XElement(namespaces["bxd"] + "SoftwareId", softwareId), // Hard coded in MessageService.cs to FRENDS
                         new XElement(namespaces["bxd"] + "FileType", fileType)));
 }
Example #4
0
        // Creates application request for getting a list of available files
        private static XElement GetFileListApplicationRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, string fileType, string targetId, DateTime?startDate, DateTime?endDate, Status status, Dictionary <string, XNamespace> namespaces)
        {
            var properties = new List <XElement>
            {
                new XElement(namespaces["bxd"] + "CustomerId", customerId),
                new XElement(namespaces["bxd"] + "Command", "DownloadFileList"),
                new XElement(namespaces["bxd"] + "Timestamp", timestamp),
                startDate.HasValue ? new XElement(namespaces["bxd"] + "StartDate", startDate.Value.ToString("yyyy-MM-dd")) : null,
                endDate.HasValue ? new XElement(namespaces["bxd"] + "EndDate", endDate.Value.ToString("yyyy-MM-dd")) : null,
                new XElement(namespaces["bxd"] + "Status", status.ToString()),
                new XElement(namespaces["bxd"] + "Environment", environment.ToString()),
                new XElement(namespaces["bxd"] + "TargetId", targetId),
                new XElement(namespaces["bxd"] + "SoftwareId", softwareId), // Hard coded in MessageService.cs to FRENDS
                new XElement(namespaces["bxd"] + "FileType", fileType)
            };

            return(new XElement(namespaces["bxd"] + "ApplicationRequest", properties.Where(p => p != null)));
        }