{"id":269304,"date":"2015-11-30T14:59:02","date_gmt":"2015-11-30T11:59:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=269304"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=269304","title":{"rendered":"\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 WCF-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e Castle.DynamicProxy"},"content":{"rendered":"<p>       \u041c\u043d\u043e\u0433\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 SOAP \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0430\u043a\u0438\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c, \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 WCF \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u0418\u043c\u0435\u044f WSDL \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b svcutil. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code>[ServiceContract] public interface ISomeService  {        [OperationContract]     Response GetData(Request request); } <\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code>public class MyService {     private readonly ISomeService _someServise \t     public MyService (ISomeService someServise)     {         _someServise = someServise;     } \t     public void DoSomething()     {         var response = _someServise.GetData();         ...     } } <\/code><\/pre>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e. MyService \u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0447\u0435\u0440\u0435\u0437 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ISomeService \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u043c \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 ISomeService, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e ISomeService \u0438 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u0440\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 WCF:<\/p>\n<pre><code>public class SomeServiceWcfProxy : ISomeService {     private readonly ChannelFactory&lt;ISomeService&gt; _channelFactory; \t     public SomeServiceWcfProxy (string endpointConfigurationName)     {         _channelFactory = new ChannelFactory&lt;ISomeService&gt;(endpointConfigurationName)     } \t     public Response GetData(Request request)     {         IClientChannel channel = null;         try         {             channel = _channelFactory.CreateChannel();             channel.Open();             var result = channel.GetData(request);             channel.Close();             return result;\t\t         }         catch (Exception)         {             if (channel != null)                 channel.Abort();             throw;         }     } } <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0440\u0430\u043b\u044c\u043d\u043e \u0438 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0418 \u0442\u0443\u0442 \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <a href=\"http:\/\/http:\/\/www.castleproject.org\/projects\/dynamicproxy\/\">Castle.DynamicProxy<\/a>. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 IInterceptor \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Intercept:<\/p>\n<pre><code>public class WcfProxyInterceptor&lt;TWcfServiceInterface&gt; : IInterceptor where TWcfServiceInterface : class {     private readonly ChannelFactory&lt;TWcfServiceInterface&gt; _channelFactory;      public WcfProxyInterceptor(IChannelFactoryProvider&lt;TWcfServiceInterface&gt; channelFactoryProvider)     {         _channelFactory = channelFactoryProvider.GetChannelFactory();                }      public void Intercept(IInvocation invocation)     {         IClientChannel channel = null;         try         {             channel = (IClientChannel)_channelFactory.CreateChannel();             channel.Open();             invocation.ReturnValue = invocation.Method.Invoke(channel, invocation.Arguments);             channel.Close();         }         catch (Exception e)         {             if (channel != null)                 channel.Abort(); \t\t\t\t\t             var ex = e as TargetInvocationException;             if (ex != null)                 throw ex.InnerException; \t\t\t\t\t             throw;         }     } }  public interface IChannelFactoryProvider&lt;TWcfServiceInterface&gt;  where TWcfServiceInterface : class {     ChannelFactory&lt;TWcfServiceInterface&gt; GetChannelFactory(); } <\/code><\/pre>\n<p>  \u041f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 IChannelFactoryProvider \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 ChannelFactory \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u0442 endpointConfigurationName \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438\/\u0437\u0430\u043a\u0440\u044b\u0442\u043e\u0441\u0442\u0438 \u0438\u0437 \u043d\u0430\u0431\u043e\u0440\u0430 SOLID. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f IChannelFactoryProvider \u0434\u043b\u044f Basic-\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0438\u0434:<\/p>\n<pre><code>public class BasicAuthChannelFactoryProvider&lt;TWcfServiceInterface&gt; : IChannelFactoryProvider&lt;TWcfServiceInterface&gt; where TWcfServiceInterface : class {     private readonly string _endpointConfigurationName;     private readonly string _userName;     private readonly string _password;      public BasicAuthChannelFactoryProvider(string endpointConfigurationName, string userName, string password)     {         _endpointConfigurationName = endpointConfigurationName;         _userName = userName;         _password = password;     }      public ChannelFactory&lt;TWcfServiceInterface&gt; GetChannelFactory()     {         var channelFactory = new ChannelFactory&lt;TWcfServiceInterface&gt;(_endpointConfigurationName);         var clientCredentials = new ClientCredentials();         clientCredentials.UserName.UserName = _userName;         clientCredentials.UserName.Password = _password;         channelFactory.Endpoint.Behaviors.RemoveAll&lt;ClientCredentials&gt;();         channelFactory.Endpoint.Behaviors.Add(clientCredentials);         return channelFactory;     } } <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 ISomeService \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 IInterceptor \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Castle.DynamicProxy \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 ProxyGenerator. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 MyService \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code>var pg = new ProxyGenerator(); var someInterfaceWcfProxy = pg.CreateInterfaceProxyWithoutTarget&lt;ISomeService&gt;(     new WcfProxyInterceptor&lt;ISomeService&gt;(new BasicAuthChannelFactoryProvider&lt;ISomeService&gt;(&quot;myEndpoint&quot;,&quot;user&quot;,&quot;pass&quot;))); var myService = new MyService(someInterfaceWcfProxy); <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 MyService \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 Castle Windsor. <\/p>\n<pre><code>IWindsorContainer container = new WindsorContainer(new XmlInterpreter()); container.Register(Component.For&lt;BasicAuthChannelFactoryProvider&lt;ISomeService&gt;&gt;().Named(&quot;basicChannelFactoryProvider&quot;)); container.Register(Component.For&lt;WcfProxyInterceptor&lt;ISomeService&gt;&gt;().Named(&quot;myWcfProxy&quot;)     .DependsOn((Dependency.OnComponent(typeof(IChannelFactoryProvider&lt;ISomeService&gt;), &quot;basicChannelFactoryProvider&quot;)))); container.Register(Component.For&lt;ISomeService&gt;().Interceptors(InterceptorReference.ForKey(&quot;myWcfProxy&quot;)).First); container.Register(Component.For&lt;MyService&gt;());  var myProxy = container.Resolve&lt;MyService&gt;(); <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 BasicAuthChannelFactoryProvider \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"xml\">&lt;configSections&gt;     &lt;section name=&quot;castle&quot; type=&quot;Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor&quot; \/&gt; &lt;\/configSections&gt; &lt;castle&gt;   &lt;components&gt;      &lt;component id=&quot;basicChannelFactoryProvider&quot;&gt;         &lt;parameters&gt;            &lt;endpointConfigurationName&gt;myEndpoint&lt;\/endpointConfigurationName&gt;            &lt;userName&gt;user&lt;\/userName&gt;            &lt;password&gt;pass&lt;\/password&gt;         &lt;\/parameters&gt;      &lt;\/component&gt; \t  ... \t  <\/code><\/pre>\n<p>  \u0412 \u0434\u0440\u0443\u0433\u0438\u0445 DI \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 CreateInterfaceProxyWithoutTarget \u043a\u043b\u0430\u0441\u0441\u0430 ProxyGenerator \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Castle.DynamicProxy.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/271973\/\"> http:\/\/habrahabr.ru\/post\/271973\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041c\u043d\u043e\u0433\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 SOAP \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0430\u043a\u0438\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c, \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 WCF \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u0418\u043c\u0435\u044f WSDL \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b svcutil. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code>[ServiceContract] public interface ISomeService  {        [OperationContract]     Response GetData(Request request); } <\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-269304","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269304","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269304"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/269304\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269304"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269304"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269304"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}