// This has not yet been implemented public static string GetCertificatesMessage(string customerId, Environment environment, int requestId, string transferKey) { var timestamp = DateTime.Now; var soapBodyContent = Helper.GetCertificatesRequest( customerId: customerId, timestamp: timestamp, environment: environment, softwareId: SoftwareId, requestId: requestId, namespaces: FewNamespaces, transferKey: transferKey); var soapRequestDocument = Helper.GetEmptySoapEnvelope(soapBodyContent, timestamp, FewNamespaces); return(soapRequestDocument.OuterXml); }
// This message can be used to query user information from web service public static string GetUserInfoMessage(X509Certificate2 certificate, string customerId, string targetId, Environment environment, int requestId) { var timestamp = DateTime.Now; var soapBodyContent = Helper.GetUserInfoRequest( customerId: customerId, targetId: targetId, timestamp: timestamp, environment: environment, softwareId: SoftwareId, requestId: requestId, certificate: certificate, namespaces: Namespaces); var soapRequestDocument = Helper.GetSoapRequestXmlDocument(certificate, soapBodyContent, timestamp, Namespaces); return(soapRequestDocument.OuterXml); }
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); }
// Creates application request for uploading a file private static XElement GetUploadFileApplicationRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, Dictionary <string, XNamespace> namespaces, string fileInput, string fileType, Encoding fileEncoding, string targetId) { var compressedFile = GzipAndBase64Encode(fileInput, fileEncoding); return(new XElement(namespaces["bxd"] + "ApplicationRequest", new XElement(namespaces["bxd"] + "CustomerId", customerId), new XElement(namespaces["bxd"] + "Command", "UploadFile"), new XElement(namespaces["bxd"] + "Timestamp", timestamp), new XElement(namespaces["bxd"] + "Environment", environment.ToString()), new XElement(namespaces["bxd"] + "TargetId", targetId), new XElement(namespaces["bxd"] + "Compression", true), // This needs to be true since the content is compressed with Gzip new XElement(namespaces["bxd"] + "CompressionMethod", "GZIP"), // Needs to be given, since also PKZIP is supported new XElement(namespaces["bxd"] + "SoftwareId", softwareId), // Hard coded in MessageService.cs to FRENDS new XElement(namespaces["bxd"] + "FileType", fileType), new XElement(namespaces["bxd"] + "Content", compressedFile))); }
// 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))); }
private static XElement GetCertificateApplicationRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, Dictionary <string, XNamespace> namespaces, string transferKey, string pkcs10 = null) { var properties = new List <XElement> { new XElement(namespaces["bxd"] + "CustomerId", customerId), new XElement(namespaces["bxd"] + "Timestamp", timestamp), new XElement(namespaces["bxd"] + "Environment", environment.ToString()), new XElement(namespaces["bxd"] + "SoftwareId", softwareId), new XElement(namespaces["bxd"] + "Service", "MATU"), string.IsNullOrEmpty(pkcs10) ? null : new XElement(namespaces["bxd"] + "Content", pkcs10), new XElement(namespaces["bxd"] + "TransferKey", transferKey) }.Where(p => p != null); return(new XElement(namespaces["bxd"] + "CertApplicationRequest", properties)); }
// Creates application request for fetching user info private static XElement GetUserInfoApplicationRequest(string customerId, string targetId, DateTime timestamp, Environment environment, string softwareId, Dictionary <string, XNamespace> namespaces) { return(new XElement(namespaces["bxd"] + "ApplicationRequest", new XElement(namespaces["bxd"] + "CustomerId", customerId), new XElement(namespaces["bxd"] + "Command", "GetUserInfo"), new XElement(namespaces["bxd"] + "Timestamp", timestamp), new XElement(namespaces["bxd"] + "Environment", environment.ToString()), !String.IsNullOrEmpty(targetId) ? new XElement(namespaces["bxd"] + "TargetId", targetId) : null, new XElement(namespaces["bxd"] + "SoftwareId", softwareId))); // Hard coded in MessageService.cs to FRENDS }
public static XElement GetCertificateRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, int requestId, Dictionary <string, XNamespace> namespaces, string transferKey, string pkcs10) { var applicationRequest = GetCertificateApplicationRequest(customerId, timestamp, environment, softwareId, namespaces, transferKey, pkcs10); var requestBase64 = GetBase64String(applicationRequest.ToString()); var requestHeader = GetSimpleRequestHeader(namespaces["opc"], customerId, requestId, timestamp); return(new XElement(namespaces["opc"] + "getCertificatein", requestHeader, new XElement(namespaces["opc"] + "ApplicationRequest", requestBase64))); }
// Builds SOAP request body for uploading a file public static XElement GetUploadFileRequest(string customerId, DateTime timestamp, Environment environment, string softwareId, int requestId, X509Certificate2 certificate, Dictionary <string, XNamespace> namespaces, string fileInput, string fileType, Encoding fileEncoding, string targetId) { var applicationRequest = GetUploadFileApplicationRequest(customerId, timestamp, environment, softwareId, namespaces, fileInput, fileType, fileEncoding, targetId); var requestBase64 = SignApplicationRequestAndReturnAsBase64(applicationRequest, certificate); var requestHeader = GetRequestHeader(customerId, requestId, timestamp, softwareId, namespaces); return(new XElement(namespaces["cor"] + "uploadFilein", requestHeader, new XElement(namespaces["mod"] + "ApplicationRequest", requestBase64))); }
// Builds SOAP request body for getting user info public static XElement GetUserInfoRequest(string customerId, string targetId, DateTime timestamp, Environment environment, string softwareId, int requestId, X509Certificate2 certificate, Dictionary <string, XNamespace> namespaces) { var applicationRequest = GetUserInfoApplicationRequest(customerId, targetId, timestamp, environment, softwareId, namespaces); var requestBase64 = SignApplicationRequestAndReturnAsBase64(applicationRequest, certificate); var requestHeader = GetRequestHeader(customerId, requestId, timestamp, softwareId, namespaces); return(new XElement(namespaces["cor"] + "getUserInfoin", requestHeader, new XElement(namespaces["mod"] + "ApplicationRequest", requestBase64))); }
// Builds SOAP request body for getting a list of available files public static XElement GetDownloadFileListRequest(string customerId, DateTime timestamp, string fileType, string targetId, DateTime?startDate, DateTime?endDate, Status status, Environment environment, string softwareId, int requestId, X509Certificate2 certificate, Dictionary <string, XNamespace> namespaces) { var applicationRequest = GetFileListApplicationRequest(customerId, timestamp, environment, softwareId, fileType, targetId, startDate, endDate, status, namespaces); var requestBase64 = SignApplicationRequestAndReturnAsBase64(applicationRequest, certificate); var requestHeader = GetRequestHeader(customerId, requestId, timestamp, softwareId, namespaces); return(new XElement(namespaces["cor"] + "downloadFileListin", requestHeader, new XElement(namespaces["mod"] + "ApplicationRequest", requestBase64))); }
// 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))); }