diff --git a/GUIs.Test.EDMIBenchmark/Form1.vb b/GUIs.Test.EDMIBenchmark/Form1.vb index f480a0a4..24fa45d0 100644 --- a/GUIs.Test.EDMIBenchmark/Form1.vb +++ b/GUIs.Test.EDMIBenchmark/Form1.vb @@ -42,7 +42,7 @@ Public Class Form1 Dim oFileName As String = oItem Dim oFileInfo As New FileInfo(oFileName) - listboxLog.Items.Add($"Importing {oFileInfo.Name}...") + listboxLog.Items.Add($"Importing {oFileInfo.Name}... ({FormatBytes(oFileInfo.Length)})") Dim oContents As Byte() = New Byte(oFileInfo.Length) {} @@ -58,7 +58,6 @@ Public Class Form1 End If oSW.Stop() listboxLog.Items.Add($"Import Time: {FormatTime(oSW.ElapsedMilliseconds)}") - listboxLog.Items.Add($"File Size: {FormatBytes(oFileInfo.Length)}") listboxLog.Items.Add("") Next diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration.svcinfo b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration.svcinfo index 424ca5c2..7ea472c2 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration.svcinfo +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration.svcinfo @@ -2,9 +2,9 @@ - + - + \ No newline at end of file diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration91.svcinfo b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration91.svcinfo index f5be33e2..84310bc2 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration91.svcinfo +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/configuration91.svcinfo @@ -1,5 +1,5 @@ - + @@ -81,8 +81,8 @@ System.ServiceModel.Configuration.NetTcpSecurityElement - - None + + Transport System.ServiceModel.Configuration.TcpTransportSecurityElement @@ -156,14 +156,14 @@ System.ServiceModel.Configuration.ServicePrincipalNameElement - - + + host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works System.ServiceModel.Configuration.DnsElement - - localhost + + System.ServiceModel.Configuration.RsaElement diff --git a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl index 5533cda6..1c267d7c 100644 --- a/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl +++ b/Modules.EDMIAPI/Connected Services/EDMIServiceReference/service.wsdl @@ -5,6 +5,29 @@ + + + + + + EncryptAndSign + + + + + + + + + + + + + + + + + @@ -149,7 +172,7 @@ net.tcp://localhost:9000/DigitalData/Services/Main - localhost + host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works diff --git a/Modules.EDMIAPI/Document.vb b/Modules.EDMIAPI/Document.vb index 887bc9a8..21121216 100644 --- a/Modules.EDMIAPI/Document.vb +++ b/Modules.EDMIAPI/Document.vb @@ -53,15 +53,17 @@ Public Class Document ''' ''' The filename to import ''' A document object - Public Function ImportFile(FilePath As String) As DocumentResult + Public Async Function ImportFileAsync(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As Task(Of DocumentResult2) Try - Dim oContents As Byte() = File.ReadAllBytes(FilePath) Dim oInfo As New FileInfo(FilePath) - Dim oName As String = oInfo.Name - Dim oExtension As String = oInfo.Extension.Substring(1) - Dim oDocObject = _channel.NewFile(oName, oContents) - Return oDocObject + Using oStream As New FileStream(FilePath, FileMode.Open) + Dim oContents As Byte() = {} + Dim oBytesRead = Await oStream.ReadAsync(oContents, 0, oStream.Length) + Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod) + + Return oResult + End Using Catch ex As Exception _logger.Error(ex) Throw ex @@ -73,34 +75,11 @@ Public Class Document ''' ''' The filename to import ''' A document object - Public Async Function ImportFile2(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = -1) As Task(Of DocumentResult2) + Public Function ImportFile(FilePath As String, Optional [ReadOnly] As Boolean = False, Optional RetentionPeriod As Integer = 0) As DocumentResult2 Try Dim oContents As Byte() = File.ReadAllBytes(FilePath) Dim oInfo As New FileInfo(FilePath) - Dim oName As String = oInfo.Name - Dim oExtension As String = oInfo.Extension.Substring(1) - - Dim oResult = Await _channel.ImportFileAsync(oInfo, oContents, [ReadOnly], RetentionPeriod) - Return oResult - Catch ex As Exception - _logger.Error(ex) - Throw ex - End Try - End Function - - ''' - ''' Imports a file by filename - ''' - ''' The filename to import - ''' A document object - Public Async Function ImportFileAsync(FilePath As String) As Task(Of DocumentResult) - Try - Dim oContents As Byte() = File.ReadAllBytes(FilePath) - Dim oInfo As New FileInfo(FilePath) - Dim oName As String = oInfo.Name - Dim oExtension As String = oInfo.Extension.Substring(1) - - Dim oDocObject = Await _channel.NewFileAsync(oName, oContents) + Dim oDocObject = _channel.ImportFile(oInfo, oContents, [ReadOnly], RetentionPeriod) Return oDocObject Catch ex As Exception _logger.Error(ex) @@ -108,45 +87,85 @@ Public Class Document End Try End Function - Public Async Function NewFileIndexAsync(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As Task(Of IndexResult) - Try - Dim oResult As IndexResult = Await _channel.NewFileIndexAsync(DocObject, Syskey, LanguageCode, Value) + '''' + '''' Imports a file by filename + '''' + '''' The filename to import + '''' A document object + 'Public Function ImportFile(FilePath As String) As DocumentResult + ' Try + ' Dim oContents As Byte() = File.ReadAllBytes(FilePath) + ' Dim oInfo As New FileInfo(FilePath) + ' Dim oName As String = oInfo.Name + ' Dim oExtension As String = oInfo.Extension.Substring(1) - Return oResult - Catch ex As Exception - _logger.Error(ex) - Throw ex - End Try - End Function + ' Dim oDocObject = _channel.NewFile(oName, oContents) + ' Return oDocObject + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function - Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult - Try - Dim oResult As IndexResult = _channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value) + '''' + '''' Imports a file by filename + '''' + '''' The filename to import + '''' A document object + 'Public Async Function ImportFileAsync(FilePath As String) As Task(Of DocumentResult) + ' Try + ' Dim oContents As Byte() = File.ReadAllBytes(FilePath) + ' Dim oInfo As New FileInfo(FilePath) + ' Dim oName As String = oInfo.Name + ' Dim oExtension As String = oInfo.Extension.Substring(1) - Return oResult - Catch ex As Exception - _logger.Error(ex) - Throw ex - End Try - End Function + ' Dim oDocObject = Await _channel.NewFileAsync(oName, oContents) + ' Return oDocObject + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function - Public Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult - Try - Return _channel.GetDocumentByDocumentId(DocumentId) - Catch ex As Exception - _logger.Error(ex) - Throw ex - End Try - End Function + 'Public Async Function NewFileIndexAsync(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As Task(Of IndexResult) + ' Try + ' Dim oResult As IndexResult = Await _channel.NewFileIndexAsync(DocObject, Syskey, LanguageCode, Value) - Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult - Try - Return _channel.GetDocumentByContainerId(ContainerId) - Catch ex As Exception - _logger.Error(ex) - Throw ex - End Try - End Function + ' Return oResult + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function + + 'Public Function NewFileIndex(DocObject As DocumentObject, Syskey As String, LanguageCode As String, Value As String) As IndexResult + ' Try + ' Dim oResult As IndexResult = _channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value) + + ' Return oResult + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function + + 'Public Function GetDocumentByDocumentId(DocumentId As Int64) As DocumentResult + ' Try + ' Return _channel.GetDocumentByDocumentId(DocumentId) + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function + + 'Public Function GetDocumentByContainerId(ContainerId As String) As DocumentResult + ' Try + ' Return _channel.GetDocumentByContainerId(ContainerId) + ' Catch ex As Exception + ' _logger.Error(ex) + ' Throw ex + ' End Try + 'End Function ''' ''' Aborts the channel and creates a new connection diff --git a/Modules.EDMIAPI/app.config b/Modules.EDMIAPI/app.config index 8af607c5..8da9bc40 100644 --- a/Modules.EDMIAPI/app.config +++ b/Modules.EDMIAPI/app.config @@ -26,7 +26,7 @@ - + @@ -37,7 +37,7 @@ binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="EDMIServiceReference.IEDMIService" name="tcpBinding"> - + diff --git a/Service.EDMIService/App.config b/Service.EDMIService/App.config index 051f0ecb..23db2755 100644 --- a/Service.EDMIService/App.config +++ b/Service.EDMIService/App.config @@ -31,13 +31,15 @@ - + - +