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

@@ -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>