/// <summary> /// NotifyDocument11 /// </summary> /// <returns></returns> public string NotifyDocument11(string nodeEndpoint, string flow, params string[] documentFilePaths) { List <wsdl.NodeDocument> wsdlDocs = new List <wsdl.NodeDocument>(); if (documentFilePaths != null) { foreach (string doc in documentFilePaths) { if (!File.Exists(doc)) { throw new IOException("Specified file does not exists: " + doc); } wsdl.NodeDocument wsdlDoc = new wsdl.NodeDocument(); wsdlDoc.content = File.ReadAllBytes(doc); wsdlDoc.name = Path.GetFileName(doc); switch (Path.GetExtension(doc).ToUpper()) { case ".XML": wsdlDoc.type = "XML"; break; case ".ZIP": wsdlDoc.type = "ZIP"; break; case ".TXT": wsdlDoc.type = "Flat"; break; case ".BIN": wsdlDoc.type = "Bin"; break; default: wsdlDoc.type = "OTHER"; break; } wsdlDocs.Add(wsdlDoc); } } string transactionId = _requestor.Notify(Authenticate(), nodeEndpoint, flow, wsdlDocs.ToArray()); return(transactionId); }
private Windsor.Node.Proxy11.WSDL.NodeDocument[] GetNodeDocumentArray(IList <EndpointDocument> documents) { List <Windsor.Node.Proxy11.WSDL.NodeDocument> list = new List <Windsor.Node.Proxy11.WSDL.NodeDocument>(); foreach (EndpointDocument endpointDocument in documents) { Windsor.Node.Proxy11.WSDL.NodeDocument doc = new Windsor.Node.Proxy11.WSDL.NodeDocument(); if (endpointDocument.ContentBytes != null) { doc.content = endpointDocument.ContentBytes; } else if (endpointDocument.ContentFilePath != null) { doc.content = File.ReadAllBytes(endpointDocument.ContentFilePath); } else { throw new ArgumentException("endpointDocument does not have content"); } doc.name = endpointDocument.DocName; switch (endpointDocument.DocType) { case CommonContentType.ZIP: doc.type = "ZIP"; break; case CommonContentType.XML: doc.type = "XML"; break; case CommonContentType.Flat: doc.type = "Flat"; break; case CommonContentType.Bin: doc.type = "Bin"; break; default: doc.type = "OTHER"; break; } list.Add(doc); } return(list.ToArray()); }
private string[] SaveDownloadedDocuments(Windsor.Node.Proxy11.WSDL.NodeDocument[] documents, string downloadDirectory) { if ((documents != null) && (documents.Length > 0)) { string downloadDir = downloadDirectory ?? Path.Combine(_tempPath, Guid.NewGuid().ToString()); Directory.CreateDirectory(downloadDir); string[] newDocPaths = new string[documents.Length]; for (int i = 0; i < documents.Length; ++i) { Windsor.Node.Proxy11.WSDL.NodeDocument newDoc = documents[i]; string docName; if (!string.IsNullOrEmpty(newDoc.name)) { docName = newDoc.name; } else { docName = Guid.NewGuid().ToString(); } string newDocPath = Path.Combine(downloadDir, docName); if (File.Exists(newDocPath)) { newDocPath = Path.Combine(downloadDir, Guid.NewGuid().ToString()); } File.WriteAllBytes(newDocPath, newDoc.content); newDocPaths[i] = newDocPath; } return(newDocPaths); } else { return(new string[0]); } }
public string[] DownloadByName(string flow, string transactionId, params string[] documentNames) { if (CollectionUtils.IsNullOrEmpty(documentNames)) { throw new ArgumentException("documentNames cannot be empty"); } Windsor.Node.Proxy11.WSDL.NodeDocument[] documents = new Windsor.Node.Proxy11.WSDL.NodeDocument[documentNames.Length]; for (int i = 0; i < documentNames.Length; ++i) { Windsor.Node.Proxy11.WSDL.NodeDocument document = new Windsor.Node.Proxy11.WSDL.NodeDocument(); document.name = documentNames[i]; CommonContentType type = CommonContentAndFormatProvider.GetFileTypeFromName(document.name); if (type == CommonContentType.OTHER) { type = CommonContentType.XML; // Assume XML } document.type = type.ToString(); documents[i] = document; } _requestor.Download(Authenticate(), transactionId, flow, ref documents); return(SaveDownloadedDocuments(documents, null)); //throw new InvalidOperationException("DownloadByName() is not a valid method call for Client11"); }