Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added possibility to configure streamed binding

  • Loading branch information...
commit 3df8b2128aa4e0263b02373ac5ee335572598b68 1 parent 7607fde
Markus Zorn authored
View
19 GraphDS/Client/Implementations/GraphDSRemoteClient/GraphDS_RemoteClient.cs
@@ -33,14 +33,22 @@ public class GraphDS_RemoteClient : IGraphDSClient, ITransactionable, IServiceTo
private StreamedService _StreamedService;
private SecurityToken _SecurityToken;
private Int64 _TransactionToken;
+
+ public Boolean UseStreaming { get; private set; }
#endregion
#region Constructor
- public GraphDS_RemoteClient(Uri myServiceAddress, bool myIsSecure = false)
+ public GraphDS_RemoteClient(Uri myServiceAddress, bool myIsSecure = false, bool myUseStreaming = false)
{
+ #if __MonoCS__
+ UseStreaming = false;
+ #else
+ UseStreaming = myUseStreaming;
+ #endif
+
BasicHttpBinding BasicBinding = new BasicHttpBinding();
BasicBinding.Name = "sonesBasic";
BasicBinding.MessageEncoding = WSMessageEncoding.Text;
@@ -62,10 +70,13 @@ public GraphDS_RemoteClient(Uri myServiceAddress, bool myIsSecure = false)
StreamedBinding.Name = "sonesStreamed";
StreamedBinding.MessageEncoding = WSMessageEncoding.Text;
StreamedBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
- StreamedBinding.TransferMode = TransferMode.Streamed;
- StreamedBinding.MaxReceivedMessageSize = 2147483648;
- StreamedBinding.MaxBufferSize = 4096;
+ StreamedBinding.MaxReceivedMessageSize = 2147483647;
+ StreamedBinding.MaxBufferSize = (UseStreaming == true) ? 4096 : 2147483647;
StreamedBinding.SendTimeout = new TimeSpan(1, 0, 0, 0);
+ if (UseStreaming == true)
+ {
+ StreamedBinding.TransferMode = TransferMode.Streamed;
+ }
if (myIsSecure == true)
{
View
6 Plugins/GraphDS/Services/Implementations/RemoteAPIService/RemoteAPIService.cs
@@ -82,8 +82,12 @@ public void Start(IDictionary<string, object> myStartParameter = null)
if (myStartParameter != null && myStartParameter.ContainsKey("Port"))
Port = (ushort)Convert.ChangeType(myStartParameter["Port"], typeof(ushort));
+ bool UseStreaming = false;
+ if (myStartParameter != null && myStartParameter.ContainsKey("UseStreaming"))
+ UseStreaming = (bool)Convert.ChangeType(myStartParameter["UseStreaming"], typeof(bool));
+
_RunningTime.Start();
- _RPCServer = new sonesRPCServer(_GraphDS, Address, Port, UriPattern, _IsSecure);
+ _RPCServer = new sonesRPCServer(_GraphDS, Address, Port, UriPattern, _IsSecure, UseStreaming);
_RPCServer.StartServiceHost();
_description = " * RemoteAPI Service is started at " + _RPCServer.URI + Environment.NewLine +
" * web service definition can be found at " + Environment.NewLine +
View
29 Plugins/GraphDS/Services/Implementations/RemoteAPIService/sonesRPCServer.cs
@@ -63,6 +63,11 @@ public class sonesRPCServer
/// Indicates wether the Server uses SSL
/// </summary>
public Boolean IsSecure { get; private set; }
+
+ /// <summary>
+ /// Indicates wether the Server provides the streamed binding
+ /// </summary>
+ public Boolean UseStreaming { get; private set; }
/// <summary>
/// Indicates wether the Server is running
@@ -104,8 +109,14 @@ public class sonesRPCServer
#region C'tor
- public sonesRPCServer(IGraphDS myGraphDS, IPAddress myIPAdress, ushort myPort, String myURI, Boolean myIsSecure, Boolean myAutoStart = false, Boolean myIsSingleFile = false)
+ public sonesRPCServer(IGraphDS myGraphDS, IPAddress myIPAdress, ushort myPort, String myURI, Boolean myIsSecure, Boolean myUseStreaming = false, Boolean myAutoStart = false, Boolean myIsSingleFile = false)
{
+
+ #if __MonoCS__
+ this.UseStreaming = false;
+ #else
+ this.UseStreaming = myUseStreaming;
+ #endif
this._GraphDS = myGraphDS;
this.IsSecure = myIsSecure;
this.ListeningIPAdress = myIPAdress;
@@ -114,6 +125,8 @@ public sonesRPCServer(IGraphDS myGraphDS, IPAddress myIPAdress, ushort myPort, S
this.URI = new Uri((myIsSecure == true ? "https://" : "http://") + myIPAdress.ToString() + ":" + myPort + "/" + myURI);
this.MexUri = new Uri("http://" + myIPAdress.ToString() + ":" + (myPort + 1) + "/" + myURI);
+
+
if (!this.URI.IsWellFormedOriginalString())
throw new Exception("The URI Pattern is not well formed!");
@@ -148,27 +161,29 @@ private void InitializeServer()
readerQuotas.MaxArrayLength = 2147483647;
BasicBinding.ReaderQuotas = readerQuotas;
+
BasicHttpBinding StreamedBinding = new BasicHttpBinding();
StreamedBinding.Name = "sonesStreamed";
StreamedBinding.Namespace = Namespace;
StreamedBinding.MessageEncoding = WSMessageEncoding.Text;
StreamedBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
- StreamedBinding.TransferMode = TransferMode.Streamed;
- StreamedBinding.MaxReceivedMessageSize = 2147483648;
- StreamedBinding.MaxBufferSize = 4096;
+ StreamedBinding.MaxReceivedMessageSize = 2147483647;
+ StreamedBinding.MaxBufferSize = (UseStreaming == true) ? 4096 : 2147483647;
StreamedBinding.SendTimeout = new TimeSpan(1, 0, 0, 0);
StreamedBinding.ReceiveTimeout = new TimeSpan(1, 0, 0, 0);
+ if (UseStreaming == true)
+ {
+ StreamedBinding.TransferMode = TransferMode.Streamed;
+ }
WebHttpBinding WebBinding = new WebHttpBinding();
WebBinding.Name = "sonesWeb";
WebBinding.Namespace = Namespace;
WebBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
-
-
if (IsSecure)
{
- BasicBinding.Security.Mode = BasicHttpSecurityMode.Transport;
+ BasicBinding.Security.Mode = BasicHttpSecurityMode.Transport;
StreamedBinding.Security.Mode = BasicHttpSecurityMode.Transport;
}
Please sign in to comment.
Something went wrong with that request. Please try again.