Esempio n. 1
0
        /// <summary>
        /// Generates the web service proxy type.
        /// </summary>
        protected virtual void GenerateProxy()
        {
            IProxyTypeBuilder builder;

            if (ProxyType != null)
            {
                // Wrap .NET generated proxy class or another
                builder            = new WebServiceProxyProxyTypeBuilder();
                builder.TargetType = ProxyType;
            }
            else
            {
                // Dynamically generates proxy class from WSDL
                builder = new SoapHttpClientProxyTypeBuilder(
                    ServiceUri, GetWsDocuments(ServiceUri), BindingName);
                builder.BaseType = WebServiceProxyBaseType;
            }

            builder.Interfaces       = ReflectionUtils.ToInterfaceArray(ServiceInterface);
            builder.TypeAttributes   = TypeAttributes;
            builder.MemberAttributes = MemberAttributes;

            Type wrapper = builder.BuildProxyType();

            proxyConstructor = wrapper.GetConstructor(Type.EmptyTypes);

            #region Instrumentation

            if (LOG.IsDebugEnabled)
            {
                if (ServiceUri != null)
                {
                    LOG.Debug(
                        String.Format("Generated client proxy type [{0}] for web service [{1}]", wrapper.FullName,
                                      ServiceUri.Description));
                }
                else if (ProxyType != null)
                {
                    LOG.Debug(
                        String.Format("Generated client proxy type [{0}] for web service based on provided proxy type [{1}]", wrapper.FullName,
                                      ProxyType.FullName));
                }
            }

            #endregion
        }
        /// <summary>
        /// Generates the web service proxy type.
        /// </summary>
        protected virtual void GenerateProxy()
        {
            IProxyTypeBuilder builder;
            if (ProxyType != null)
            {
                // Wrap .NET generated proxy class or another
                builder = new WebServiceProxyProxyTypeBuilder();
                builder.TargetType = ProxyType;
            }
            else
            {
                // Dynamically generates proxy class from WSDL
                builder = new SoapHttpClientProxyTypeBuilder(
                    ServiceUri, GetWsDocuments(ServiceUri), BindingName);
                builder.BaseType = WebServiceProxyBaseType;
            }

            builder.Interfaces = ReflectionUtils.ToInterfaceArray(ServiceInterface);
            builder.TypeAttributes = TypeAttributes;
            builder.MemberAttributes = MemberAttributes;

            Type wrapper = builder.BuildProxyType();

            proxyConstructor = wrapper.GetConstructor(Type.EmptyTypes);

            #region Instrumentation

            if (LOG.IsDebugEnabled)
            {
                if (ServiceUri != null)
                {
                    LOG.Debug(
                        String.Format("Generated client proxy type [{0}] for web service [{1}]", wrapper.FullName,
                                      ServiceUri.Description));
                }
                else if (ProxyType != null)
                {
                    LOG.Debug(
                        String.Format("Generated client proxy type [{0}] for web service based on provided proxy type [{1}]", wrapper.FullName,
                                      ProxyType.FullName));
                }
            }

            #endregion
        }