Exemplo n.º 1
0
        /// <inheritdoc />
        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine(base.ToString());

            if (this.MetadataImportErrors != null)
            {
                builder
                .AppendLine("Metadata Import Errors:")
                .AppendLine(
                    DynamicProxyFactory
                    .ToString(
                        this.MetadataImportErrors));
            }

            if (this.CodeGenerationErrors != null)
            {
                builder
                .AppendLine("Code Generation Errors:")
                .AppendLine(
                    DynamicProxyFactory
                    .ToString(
                        this.CodeGenerationErrors));
            }

            if (this.CompilationErrors != null)
            {
                builder
                .AppendLine("Compilation Errors:")
                .AppendLine(
                    DynamicProxyFactory
                    .ToString(
                        this.CompilationErrors));
            }

            return(builder.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public object CallMethod(params object[] parameters)
        {
            // Set the binding timeouts in minutes
            this._Binding.ReceiveTimeout = (new TimeSpan(0, _ServiceConfig.Timeout, 0));
            this._Binding.SendTimeout    = (new TimeSpan(0, _ServiceConfig.Timeout, 0));
            this._Binding.OpenTimeout    = (new TimeSpan(0, _ServiceConfig.Timeout, 0));


            var t = (HttpBindingBase)this._Binding;

            t.MaxReceivedMessageSize = 655360000;
            ServiceEndpoint endpoint =
                new ServiceEndpoint(
                    new ContractDescription(this._ServiceConfig.Contract),
                    t,
                    new EndpointAddress(this._ServiceConfig.EndPoint));


            DynamicProxyFactory factory = new DynamicProxyFactory(this._ServiceConfig.WsdlUri);

            foreach (ContractDescription description in factory.Contracts)
            {
                foreach (OperationDescription operation in description.Operations)
                {
                    DataContractSerializerOperationBehavior dataContractBehavior =
                        operation.Behaviors.Find <DataContractSerializerOperationBehavior>()
                        as DataContractSerializerOperationBehavior;
                    if (dataContractBehavior != null)
                    {
                        dataContractBehavior.MaxItemsInObjectGraph = 655360000;
                    }
                }
            }


            DynamicProxy proxy = factory.CreateProxy(endpoint);

            // Left In for future use if necessary
            //SetProperties(proxy);
            if (parameters == null)
            {
                parameters = new object[0];
            }
            else if (parameters.Length > 0)
            {
                if (string.IsNullOrEmpty(parameters[0].ToString()))
                {
                    parameters = new object[0];
                }
            }


            return
                (proxy
                 .CallMethod(
                     this._ServiceConfig.Method,
                     parameters));
            //return
            //	this._DynamicProxy
            //		.CallMethod(
            //			this._ServiceConfig.Method,
            //			parameters);
        }