forked from to-increase/bis-cs-inbound-ws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoapHelper.cs
45 lines (38 loc) · 1.78 KB
/
SoapHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
namespace BisConnectivityServices
{
public class SoapHelper
{
public static string GetSoapServiceUriString(string serviceName, string aosUriString)
{
var soapServiceUriStringTemplate = "{0}/soap/services/{1}";
var soapServiceUriString = string.Format(soapServiceUriStringTemplate, aosUriString.TrimEnd('/'), serviceName);
return soapServiceUriString;
}
public static Binding GetBinding()
{
var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
// Set binding timeout and other configuration settings
binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
binding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
binding.ReceiveTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
binding.MaxReceivedMessageSize = int.MaxValue;
var httpsTransportBindingElement = binding.CreateBindingElements().OfType<HttpsTransportBindingElement>().FirstOrDefault();
if (httpsTransportBindingElement != null)
{
httpsTransportBindingElement.MaxPendingAccepts = 10000; // Largest posible is 100000, otherwise throws
}
var httpTransportBindingElement = binding.CreateBindingElements().OfType<HttpTransportBindingElement>().FirstOrDefault();
if (httpTransportBindingElement != null)
{
httpTransportBindingElement.MaxPendingAccepts = 10000; // Largest posible is 100000, otherwise throws
}
return binding;
}
}
}