Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.41 KB | None | 0 0
  1.  
  2.         private VesselSchedule_OutClient GetSvc()
  3.         {
  4.             var binding = new CustomBinding();
  5.  
  6.             var tmb = new TextMessageEncodingBindingElement
  7.             {
  8.                 MaxReadPoolSize  = 64,
  9.                 MaxWritePoolSize = 16,
  10.                 WriteEncoding    = Encoding.UTF8,
  11.                 MessageVersion   = MessageVersion.Soap11,
  12.                 ReaderQuotas =
  13.                 {
  14.                     MaxDepth               = 10000000,
  15.                     MaxStringContentLength = 10000000,
  16.                     MaxArrayLength         = 67108864,
  17.                     MaxBytesPerRead        = 65536,
  18.                     MaxNameTableCharCount  = 100000
  19.                 }
  20.             };
  21.  
  22.             binding.Elements.Add(tmb);
  23.  
  24.             binding.Elements.Add(new HttpsTransportBindingElement
  25.             {
  26.                 AuthenticationScheme = AuthenticationSchemes.Basic,
  27.                 HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
  28.                 BypassProxyOnLocal = false,
  29.                 KeepAliveEnabled = false,
  30.                 ProxyAuthenticationScheme = AuthenticationSchemes.Basic,
  31.                 Realm = "XISOAPApps",
  32.                 UseDefaultWebProxy = true,
  33.                 MaxReceivedMessageSize = 9999999
  34.             });
  35.  
  36.             var scSvc = new VesselSchedule_OutClient
  37.                 (new CustomBinding(binding),
  38.                  new EndpointAddress("https://webmethods.eimskip.net/ws/EIShippingSchedule.wsd.ShippingSchedule/HTTPS_Port"));
  39.  
  40.             scSvc.ClientCredentials.UserName.UserName = "***";
  41.             scSvc.ClientCredentials.UserName.Password = "***";
  42.  
  43.             return scSvc;
  44.         }
  45.  
  46.         private VesselSchedule_OutClient GetSvc2()
  47.         {
  48.             var binding = new CustomBinding();
  49.  
  50.             var tmb = new TextMessageEncodingBindingElement
  51.             {
  52.                 //MaxReadPoolSize  = 64,
  53.                 //MaxWritePoolSize = 16,
  54.                 //WriteEncoding    = Encoding.UTF8,
  55.                 MessageVersion   = MessageVersion.Soap11,
  56.                 //ReaderQuotas =
  57.                 //{
  58.                 //    MaxDepth               = 10000000,
  59.                 //    MaxStringContentLength = 10000000,
  60.                 //    MaxArrayLength         = 67108864,
  61.                 //    MaxBytesPerRead        = 65536,
  62.                 //    MaxNameTableCharCount  = 100000
  63.                 //}
  64.             };
  65.  
  66.             binding.Elements.Add(tmb);
  67.  
  68.             binding.Elements.Add(new HttpsTransportBindingElement
  69.             {
  70.                 AuthenticationScheme = AuthenticationSchemes.Basic,
  71.                 //HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
  72.                 //BypassProxyOnLocal = false,
  73.                 //KeepAliveEnabled = false,
  74.                 //ProxyAuthenticationScheme = AuthenticationSchemes.Basic,
  75.                 //Realm = "XISOAPApps",
  76.                 //UseDefaultWebProxy = true,
  77.                 //MaxReceivedMessageSize = 9999999
  78.             });
  79.  
  80.             var scSvc = new VesselSchedule_OutClient
  81.                 (new CustomBinding(binding),
  82.                  new EndpointAddress("https://webmethods.eimskip.net/ws/EIShippingSchedule.wsd.ShippingSchedule/HTTPS_Port"));
  83.  
  84.             scSvc.ClientCredentials.UserName.UserName = "***";
  85.             scSvc.ClientCredentials.UserName.Password = "***";
  86.  
  87.             return scSvc;
  88.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement