WIP: Streaming files from service to client

This commit is contained in:
Jonathan Jenne 2020-04-14 16:25:16 +02:00
parent 52a6d103e6
commit a20c0eb4b0
19 changed files with 211 additions and 49 deletions

View File

@ -16,26 +16,42 @@ Public Class Path
_BasePath = DatastoreBasePath
End Sub
Public Function GetActivePath(DocumentType As String, Optional FileName As String = "")
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE}
oPathParts.AddRange(GetRelativePath(DocumentType, FileName))
Public Function GetActivePath(DocumentType As String, Optional FileName As String = "") As String
Dim oParts = New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE}
oParts.AddRange(Do_GetRelativePath(DocumentType, FileName))
Return IO.Path.Combine(oPathParts.ToArray())
Return IO.Path.Combine(oParts.ToArray())
End Function
Public Function GetArchivePath(DocumentType As String, Optional FileName As String = "")
Dim oPathParts As New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE}
oPathParts.AddRange(GetRelativePath(DocumentType, FileName))
Return IO.Path.Combine(oPathParts.ToArray())
Public Function GetActivePathFromRelativePath(RelativePath As String) As String
Dim oParts = New List(Of String) From {_BasePath, PATH_EDMI, PATH_ACTIVE}
oParts.Add(RelativePath)
Return IO.Path.Combine(oParts.ToArray)
End Function
Public Function GetRelativePath(DocumentType As String, Optional FileName As String = "")
Public Function GetArchivePath(DocumentType As String, Optional FileName As String = "") As String
Dim oParts = New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE}
oParts.AddRange(Do_GetRelativePath(DocumentType, FileName))
Return IO.Path.Combine(oParts.ToArray())
End Function
Public Function GetArchivePathFromRelativePath(RelativePath As String) As String
Dim oParts = New List(Of String) From {_BasePath, PATH_EDMI, PATH_ARCHIVE}
oParts.Add(RelativePath)
Return IO.Path.Combine(oParts.ToArray)
End Function
Public Function GetRelativePath(DocumentType As String, Optional FileName As String = "") As String
Return IO.Path.Combine(Do_GetRelativePath(DocumentType, FileName).ToArray)
End Function
Private Function Do_GetRelativePath(DocumentType As String, Optional FileName As String = "") As List(Of String)
Dim oPathParts As New List(Of String) From {DocumentType}
oPathParts.AddRange(GetDatePath())
oPathParts.Add(FileName)
Return IO.Path.Combine(oPathParts.ToArray())
Return oPathParts
End Function
Private Function GetDatePath() As List(Of String)

View File

@ -29,9 +29,12 @@ Partial Class Form1
Me.ButtonImportFiles = New DevExpress.XtraBars.BarButtonItem()
Me.buttonClearLog = New DevExpress.XtraBars.BarButtonItem()
Me.buttonClearFiles = New DevExpress.XtraBars.BarButtonItem()
Me.TextboxObejctId = New DevExpress.XtraBars.BarEditItem()
Me.RepositoryItemTextEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemTextEdit()
Me.ButtonLoadFile = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar()
Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage()
@ -40,9 +43,10 @@ Partial Class Form1
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage()
Me.XtraTabPage2 = New DevExpress.XtraTab.XtraTabPage()
Me.listboxFileids = New DevExpress.XtraEditors.ListBoxControl()
Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer()
CType(Me.listboxFiles, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RepositoryItemTextEdit1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.SuspendLayout()
CType(Me.listboxLog, System.ComponentModel.ISupportInitialize).BeginInit()
@ -50,7 +54,6 @@ Partial Class Form1
Me.XtraTabControl1.SuspendLayout()
Me.XtraTabPage1.SuspendLayout()
Me.XtraTabPage2.SuspendLayout()
CType(Me.listboxFileids, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'listboxFiles
@ -64,11 +67,12 @@ Partial Class Form1
'RibbonControl1
'
Me.RibbonControl1.ExpandCollapseItem.Id = 0
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.ButtonSelectFiles, Me.ButtonImportFiles, Me.buttonClearLog, Me.buttonClearFiles})
Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.ButtonSelectFiles, Me.ButtonImportFiles, Me.buttonClearLog, Me.buttonClearFiles, Me.TextboxObejctId, Me.ButtonLoadFile})
Me.RibbonControl1.Location = New System.Drawing.Point(0, 0)
Me.RibbonControl1.MaxItemId = 5
Me.RibbonControl1.MaxItemId = 7
Me.RibbonControl1.Name = "RibbonControl1"
Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1})
Me.RibbonControl1.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemTextEdit1})
Me.RibbonControl1.Size = New System.Drawing.Size(1145, 158)
Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1
'
@ -100,30 +104,51 @@ Partial Class Form1
Me.buttonClearFiles.ImageOptions.SvgImage = CType(resources.GetObject("buttonClearFiles.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.buttonClearFiles.Name = "buttonClearFiles"
'
'TextboxObejctId
'
Me.TextboxObejctId.Caption = "Document Id"
Me.TextboxObejctId.Edit = Me.RepositoryItemTextEdit1
Me.TextboxObejctId.EditWidth = 100
Me.TextboxObejctId.Id = 5
Me.TextboxObejctId.Name = "TextboxObejctId"
'
'RepositoryItemTextEdit1
'
Me.RepositoryItemTextEdit1.AutoHeight = False
Me.RepositoryItemTextEdit1.Name = "RepositoryItemTextEdit1"
'
'ButtonLoadFile
'
Me.ButtonLoadFile.Caption = "Load File"
Me.ButtonLoadFile.Id = 6
Me.ButtonLoadFile.Name = "ButtonLoadFile"
'
'RibbonPage1
'
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroup3})
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup4, Me.RibbonPageGroup3})
Me.RibbonPage1.Name = "RibbonPage1"
Me.RibbonPage1.Text = "Import Files"
Me.RibbonPage1.Text = "Start"
'
'RibbonPageGroup1
'
Me.RibbonPageGroup1.ItemLinks.Add(Me.ButtonSelectFiles)
Me.RibbonPageGroup1.ItemLinks.Add(Me.ButtonImportFiles)
Me.RibbonPageGroup1.Name = "RibbonPageGroup1"
Me.RibbonPageGroup1.Text = "RibbonPageGroup1"
Me.RibbonPageGroup1.Text = "Import"
'
'RibbonPageGroup2
'RibbonPageGroup4
'
Me.RibbonPageGroup2.ItemLinks.Add(Me.ButtonImportFiles)
Me.RibbonPageGroup2.Name = "RibbonPageGroup2"
Me.RibbonPageGroup2.Text = "RibbonPageGroup2"
Me.RibbonPageGroup4.ItemLinks.Add(Me.TextboxObejctId)
Me.RibbonPageGroup4.ItemLinks.Add(Me.ButtonLoadFile)
Me.RibbonPageGroup4.Name = "RibbonPageGroup4"
Me.RibbonPageGroup4.Text = "Retrieve"
'
'RibbonPageGroup3
'
Me.RibbonPageGroup3.ItemLinks.Add(Me.buttonClearLog)
Me.RibbonPageGroup3.ItemLinks.Add(Me.buttonClearLog, True)
Me.RibbonPageGroup3.ItemLinks.Add(Me.buttonClearFiles)
Me.RibbonPageGroup3.Name = "RibbonPageGroup3"
Me.RibbonPageGroup3.Text = "RibbonPageGroup3"
Me.RibbonPageGroup3.Text = "Utils"
'
'RibbonStatusBar1
'
@ -173,22 +198,22 @@ Partial Class Form1
Me.XtraTabPage1.Controls.Add(Me.SplitContainerControl1)
Me.XtraTabPage1.Name = "XtraTabPage1"
Me.XtraTabPage1.Size = New System.Drawing.Size(1143, 270)
Me.XtraTabPage1.Text = "XtraTabPage1"
Me.XtraTabPage1.Text = "Information"
'
'XtraTabPage2
'
Me.XtraTabPage2.Controls.Add(Me.listboxFileids)
Me.XtraTabPage2.Controls.Add(Me.DocumentViewer1)
Me.XtraTabPage2.Name = "XtraTabPage2"
Me.XtraTabPage2.Size = New System.Drawing.Size(1143, 270)
Me.XtraTabPage2.Text = "XtraTabPage2"
Me.XtraTabPage2.Text = "DocumentViewer"
'
'listboxFileids
'DocumentViewer1
'
Me.listboxFileids.Dock = System.Windows.Forms.DockStyle.Left
Me.listboxFileids.Location = New System.Drawing.Point(0, 0)
Me.listboxFileids.Name = "listboxFileids"
Me.listboxFileids.Size = New System.Drawing.Size(278, 270)
Me.listboxFileids.TabIndex = 0
Me.DocumentViewer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.DocumentViewer1.Location = New System.Drawing.Point(0, 0)
Me.DocumentViewer1.Name = "DocumentViewer1"
Me.DocumentViewer1.Size = New System.Drawing.Size(1143, 270)
Me.DocumentViewer1.TabIndex = 0
'
'Form1
'
@ -204,6 +229,7 @@ Partial Class Form1
Me.Text = "Form1"
CType(Me.listboxFiles, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RepositoryItemTextEdit1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControl1.ResumeLayout(False)
CType(Me.listboxLog, System.ComponentModel.ISupportInitialize).EndInit()
@ -211,7 +237,6 @@ Partial Class Form1
Me.XtraTabControl1.ResumeLayout(False)
Me.XtraTabPage1.ResumeLayout(False)
Me.XtraTabPage2.ResumeLayout(False)
CType(Me.listboxFileids, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -220,7 +245,6 @@ Partial Class Form1
Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl
Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage
Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar
Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage
Friend WithEvents ButtonSelectFiles As DevExpress.XtraBars.BarButtonItem
@ -232,6 +256,10 @@ Partial Class Form1
Friend WithEvents buttonClearFiles As DevExpress.XtraBars.BarButtonItem
Friend WithEvents XtraTabControl1 As DevExpress.XtraTab.XtraTabControl
Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage
Friend WithEvents TextboxObejctId As DevExpress.XtraBars.BarEditItem
Friend WithEvents RepositoryItemTextEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemTextEdit
Friend WithEvents ButtonLoadFile As DevExpress.XtraBars.BarButtonItem
Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup
Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage
Friend WithEvents listboxFileids As DevExpress.XtraEditors.ListBoxControl
Friend WithEvents DocumentViewer1 As DigitalData.Controls.DocumentViewer.DocumentViewer
End Class

View File

@ -15,6 +15,8 @@ Public Class Form1
"net.tcp://172.24.12.39:9000/DigitalData/Services/Main")
_Channel = oChannelFactory.CreateChannel()
_Channel.Open()
DocumentViewer1.Init(oLogConfig, "21182889975216572111813147150675976632")
End Sub
Private Sub ButtonSelectFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonSelectFiles.ItemClick
@ -53,7 +55,6 @@ Public Class Form1
Dim oResult As EDMIServiceReference.DocumentResult2 = Await _Channel.ImportFileAsync(oFileInfo.Name, oContents, Environment.UserName)
If oResult.OK Then
listboxLog.Items.Add($"File [{oFileInfo.Name}] with Id [{oResult.Document.FileId}] imported!")
listboxFileids.Items.Add(oResult.Document.FileId)
Else
listboxLog.Items.Add($"Import Error: {oResult.ErrorMessage}")
End If
@ -111,4 +112,25 @@ Public Class Form1
End Try
End Function
Private Async Sub ButtonLoadFile_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles ButtonLoadFile.ItemClick
Try
If TextboxObejctId.EditValue = "" Then
MsgBox("Please enter an object id!", MsgBoxStyle.Exclamation, "Uh oh!")
End If
Dim oObjectId As Integer = TextboxObejctId.EditValue
Dim oStream = Await _Channel.GetFileByObjectIdAsync(oObjectId)
Dim oMemoryStream As New MemoryStream()
oStream.CopyTo(oMemoryStream)
oMemoryStream.Position = 0
listboxLog.Items.Add("Stream read!")
DocumentViewer1.LoadFile("textfile.png", oMemoryStream)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Uh oh!")
End Try
End Sub
End Class

View File

@ -57,6 +57,12 @@
<Reference Include="DigitalData.Controls.DocumentViewer">
<HintPath>..\Controls.DocumentViewer\obj\Debug\DigitalData.Controls.DocumentViewer.dll</HintPath>
</Reference>
<Reference Include="GdPicture.NET.14">
<HintPath>D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll</HintPath>
</Reference>
<Reference Include="Independentsoft.Msg">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\MSG .NET\Bin\22_11_19\Independentsoft.Msg.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
@ -142,6 +148,10 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Controls.DocumentViewer\DocumentViewer.vbproj">
<Project>{0958cddf-4a16-41f6-8837-8335f71d599c}</Project>
<Name>DocumentViewer</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.EDMIAPI\EDMI.API.vbproj">
<Project>{25017513-0d97-49d3-98d7-ba76d9b251b0}</Project>
<Name>EDMI.API</Name>

View File

@ -1 +1,2 @@
DevExpress.XtraEditors.Repository.RepositoryItemTextEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@ -8,7 +8,7 @@ Public Class Channel
.MaxBufferSize = Constants.MAX_BUFFER_SIZE,
.MaxBufferPoolSize = Constants.MAX_BUFFER_POOL_SIZE,
.MaxConnections = Constants.MAX_CONNECTIONS,
.TransferMode = TransferMode.Buffered,
.TransferMode = TransferMode.Streamed,
.Security = New NetTcpSecurity() With {
.Mode = SecurityMode.Transport,
.Transport = New TcpTransportSecurity() With {

View File

@ -8,6 +8,7 @@
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.Data" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
<xsd:import namespace="http://schemas.microsoft.com/Message" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="IEDMIService_Heartbeat_InputMessage">
@ -88,6 +89,12 @@
<wsdl:message name="IEDMIService_ImportFile_OutputMessage">
<wsdl:part name="parameters" element="tns:ImportFileResponse" />
</wsdl:message>
<wsdl:message name="IEDMIService_GetFileByObjectId_InputMessage">
<wsdl:part name="parameters" element="tns:GetFileByObjectId" />
</wsdl:message>
<wsdl:message name="IEDMIService_GetFileByObjectId_OutputMessage">
<wsdl:part name="parameters" element="tns:GetFileByObjectIdResponse" />
</wsdl:message>
<wsdl:message name="IEDMIService_NewFileIndex_InputMessage">
<wsdl:part name="parameters" element="tns:NewFileIndex" />
</wsdl:message>
@ -147,6 +154,10 @@
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile" message="tns:IEDMIService_ImportFile_InputMessage" />
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse" message="tns:IEDMIService_ImportFile_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="GetFileByObjectId">
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId" message="tns:IEDMIService_GetFileByObjectId_InputMessage" />
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdResponse" message="tns:IEDMIService_GetFileByObjectId_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="NewFileIndex">
<wsdl:input wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndex" message="tns:IEDMIService_NewFileIndex_InputMessage" />
<wsdl:output wsaw:Action="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndexResponse" message="tns:IEDMIService_NewFileIndex_OutputMessage" />

View File

@ -2,6 +2,7 @@
<xs:schema xmlns:tns="http://DigitalData.Services.EDMIService" elementFormDefault="qualified" targetNamespace="http://DigitalData.Services.EDMIService" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" />
<xs:import namespace="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" />
<xs:import namespace="http://schemas.microsoft.com/Message" />
<xs:element name="Heartbeat">
<xs:complexType>
<xs:sequence />
@ -183,10 +184,24 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetFileByObjectId">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ObjectId" type="xs:long" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetFileByObjectIdResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q13="http://schemas.microsoft.com/Message" name="GetFileByObjectIdResult" type="q13:StreamBody" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewFileIndex">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q13:DocumentObject" />
<xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/DigitalData.Modules.Filesystem" minOccurs="0" name="DocObject" nillable="true" type="q14:DocumentObject" />
<xs:element minOccurs="0" name="Syskey" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="LanguageCode" nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="Value" nillable="true" type="xs:string" />
@ -196,7 +211,7 @@
<xs:element name="NewFileIndexResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q14:IndexResult" />
<xs:element xmlns:q15="http://schemas.datacontract.org/2004/07/DigitalData.Services.EDMIService" minOccurs="0" name="NewFileIndexResult" nillable="true" type="q15:IndexResult" />
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/Message" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Message" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="StreamBody">
<xs:restriction base="xs:base64Binary" />
</xs:simpleType>
</xs:schema>

View File

@ -30,6 +30,7 @@
<MetadataFile FileName="System.xsd" MetadataType="Schema" ID="e0db7004-6943-4cf8-b88f-4811ed14a341" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
<MetadataFile FileName="System.Data.xsd" MetadataType="Schema" ID="6c7bdb47-eea4-4d03-bc52-9747c865bbf0" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
<MetadataFile FileName="DigitalData.Modules.Filesystem.xsd" MetadataType="Schema" ID="cfa7fe70-b4f1-4a12-a957-d0134a8e6279" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
<MetadataFile FileName="Message.xsd" MetadataType="Schema" ID="4c8d0244-6e40-4635-b3d5-0a75aad0332e" SourceId="1" SourceUrl="net.tcp://172.24.12.39:9000/DigitalData/Services/Main/mex" />
</Metadata>
<Extensions>
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />

View File

@ -507,6 +507,12 @@ Namespace EDMIServiceReference
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFile", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/ImportFileResponse")> _
Function ImportFileAsync(ByVal FileName As String, ByVal Contents() As Byte, ByVal AddedWho As String) As System.Threading.Tasks.Task(Of EDMIServiceReference.DocumentResult2)
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdResponse")> _
Function GetFileByObjectId(ByVal ObjectId As Long) As System.IO.Stream
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectIdResponse")> _
Function GetFileByObjectIdAsync(ByVal ObjectId As Long) As System.Threading.Tasks.Task(Of System.IO.Stream)
<System.ServiceModel.OperationContractAttribute(Action:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndex", ReplyAction:="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndexResponse")> _
Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult
@ -649,6 +655,14 @@ Namespace EDMIServiceReference
Return MyBase.Channel.ImportFileAsync(FileName, Contents, AddedWho)
End Function
Public Function GetFileByObjectId(ByVal ObjectId As Long) As System.IO.Stream Implements EDMIServiceReference.IEDMIService.GetFileByObjectId
Return MyBase.Channel.GetFileByObjectId(ObjectId)
End Function
Public Function GetFileByObjectIdAsync(ByVal ObjectId As Long) As System.Threading.Tasks.Task(Of System.IO.Stream) Implements EDMIServiceReference.IEDMIService.GetFileByObjectIdAsync
Return MyBase.Channel.GetFileByObjectIdAsync(ObjectId)
End Function
Public Function NewFileIndex(ByVal DocObject As EDMIServiceReference.DocumentObject, ByVal Syskey As String, ByVal LanguageCode As String, ByVal Value As String) As EDMIServiceReference.IndexResult Implements EDMIServiceReference.IEDMIService.NewFileIndex
Return MyBase.Channel.NewFileIndex(DocObject, Syskey, LanguageCode, Value)
End Function

View File

@ -2,7 +2,7 @@
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data name=&quot;tcpBinding&quot;&gt;&lt;security&gt;&lt;transport sslProtocols=&quot;None&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="netTcpBinding" name="tcpBinding" />
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data name=&quot;tcpBinding&quot; transferMode=&quot;Streamed&quot;&gt;&lt;security&gt;&lt;transport sslProtocols=&quot;None&quot; /&gt;&lt;/security&gt;&lt;/Data&gt;" bindingType="netTcpBinding" name="tcpBinding" />
</bindings>
<endpoints>
<endpoint normalizedDigest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:9000/DigitalData/Services/Main&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;tcpBinding&quot; contract=&quot;EDMIServiceReference.IEDMIService&quot; name=&quot;tcpBinding&quot;&gt;&lt;identity&gt;&lt;servicePrincipalName value=&quot;host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" digest="&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-16&quot;?&gt;&lt;Data address=&quot;net.tcp://localhost:9000/DigitalData/Services/Main&quot; binding=&quot;netTcpBinding&quot; bindingConfiguration=&quot;tcpBinding&quot; contract=&quot;EDMIServiceReference.IEDMIService&quot; name=&quot;tcpBinding&quot;&gt;&lt;identity&gt;&lt;servicePrincipalName value=&quot;host/sDD-VMP03-VM09.dd-san01.dd-gan.local.digitaldata.works&quot; /&gt;&lt;/identity&gt;&lt;/Data&gt;" contractName="EDMIServiceReference.IEDMIService" name="tcpBinding" />

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="e9iHagUK3+X05AXstziypKiw8Rs=">
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="kW1pXkU3loV3ggP1jXPpV/Y9PXk=">
<bindingConfigurations>
<bindingConfiguration bindingType="netTcpBinding" name="tcpBinding">
<properties>
@ -21,8 +21,8 @@
<property path="/transactionFlow" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>False</serializedValue>
</property>
<property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Buffered</serializedValue>
<property path="/transferMode" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>Streamed</serializedValue>
</property>
<property path="/transactionProtocol" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransactionProtocol, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<serializedValue>OleTransactions</serializedValue>

View File

@ -28,6 +28,8 @@
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
<msf:Streamed xmlns:msf="http://schemas.microsoft.com/ws/2006/05/framing/policy">
</msf:Streamed>
<wsaw:UsingAddressing>
</wsaw:UsingAddressing>
</wsp:All>
@ -156,6 +158,15 @@
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFileByObjectId">
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/GetFileByObjectId" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="NewFileIndex">
<soap12:operation soapAction="http://DigitalData.Services.EDMIService/IEDMIService/NewFileIndex" style="document" />
<wsdl:input>

View File

@ -134,6 +134,9 @@
<None Include="Connected Services\EDMIServiceReference\DigitalData.Services.EDMIService1.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\EDMIServiceReference\Message.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Connected Services\EDMIServiceReference\service.wsdl" />
<None Include="Connected Services\EDMIServiceReference\service.xsd">
<SubType>Designer</SubType>

View File

@ -25,7 +25,7 @@
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="tcpBinding">
<binding name="tcpBinding" transferMode="Streamed">
<security>
<transport sslProtocols="None" />
</security>

View File

@ -50,7 +50,7 @@
<netTcpBinding>
<binding name="tcpBinding"
sendTimeout="00:10:00"
transferMode="Buffered"
transferMode="Streamed"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">

View File

@ -304,7 +304,7 @@ Public Class EDMIService
Public Function ImportFile(FileName As String, Contents() As Byte, AddedWho As String) As DocumentResult2 Implements IEDMIService.ImportFile
Dim oDocumentType As String = "DummyDocumentType"
Dim oRelativePath As String = EDMIPath.GetRelativePath(oDocumentType, FileName)
Dim oAbsolutePath As String = EDMIPath.GetActivePath(oDocumentType)
Dim oAbsolutePath As String = EDMIPath.GetActivePath(oDocumentType, FileName)
Dim oDirectoryPath = EDMIPath.GetActivePath(oDocumentType)
Dim oDocument = New DocumentResult2.DocumentObject With {.FileName = FileName}
@ -318,7 +318,7 @@ Public Class EDMIService
Try
Dim oVersionedFileName As String = Filesystem.GetVersionedFilename(oAbsolutePath)
_logger.Info("Saving file [{0}] to path [{1}]", FileName, oVersionedFileName)
_logger.Info("ImportFile: Saving file [{0}] to path [{1}]", FileName, oVersionedFileName)
Using oStream = New FileStream(oVersionedFileName, FileMode.CreateNew)
oStream.Write(Contents, 0, Contents.Length)
oStream.Flush(True)
@ -344,6 +344,27 @@ Public Class EDMIService
End Try
End Function
Public Function GetFileByObjectId(ObjectId As Int64) As Stream Implements IEDMIService.GetFileByObjectId
Try
Dim oSQL As String = $"SELECT DocRelativePath FROM VWIDB_DOC_DATA WHERE IDB_OBJ_ID = {ObjectId}"
Dim oPath As String = MSSQL.GetScalarValue(oSQL)
If IsNothing(oPath) Then
Return Nothing
End If
Dim oFullPath = EDMIPath.GetActivePathFromRelativePath(oPath)
_logger.Debug("GetFileByObjectId: Loading file [{0}]", oFullPath)
Dim oSource As FileStream = IO.File.Open(oFullPath, FileMode.Open)
Return oSource
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
End Function
#End Region
#Region "Index"

View File

@ -50,6 +50,9 @@ Interface IEDMIService
#Region "Document (New)"
<OperationContract>
Function ImportFile(FileName As String, Contents As Byte(), AddedWho As String) As DocumentResult2
<OperationContract>
Function GetFileByObjectId(ObjectId As Int64) As Stream
#End Region
#Region "Index"