//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//
//     对此文件的更改可能导致不正确的行为，并在以下条件下丢失:
//     代码重新生成。
// </auto-generated>
//------------------------------------------------------------------------------

namespace gfsbiz
{
    
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="http://www.example.org/Ec/", ConfigurationName="gfsbiz.Ec")]
    public interface Ec
    {
        
        [System.ServiceModel.OperationContractAttribute(Action="http://www.example.org/Ec/callService", ReplyAction="*")]
        System.Threading.Tasks.Task<gfsbiz.callServiceResponse> callServiceAsync(gfsbiz.callServiceRequest request);
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class callServiceRequest
    {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="callService", Namespace="http://www.example.org/Ec/", Order=0)]
        public gfsbiz.callServiceRequestBody Body;
        
        public callServiceRequest()
        {
        }
        
        public callServiceRequest(gfsbiz.callServiceRequestBody Body)
        {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="")]
    public partial class callServiceRequestBody
    {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string paramsJson;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
        public string appToken;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
        public string appKey;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=3)]
        public string customerId;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=4)]
        public string customerCode;
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=5)]
        public string service;
        
        public callServiceRequestBody()
        {
        }
        
        public callServiceRequestBody(string paramsJson, string appToken, string appKey, string customerId, string customerCode, string service)
        {
            this.paramsJson = paramsJson;
            this.appToken = appToken;
            this.appKey = appKey;
            this.customerId = customerId;
            this.customerCode = customerCode;
            this.service = service;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
    public partial class callServiceResponse
    {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Name="callServiceResponse", Namespace="http://www.example.org/Ec/", Order=0)]
        public gfsbiz.callServiceResponseBody Body;
        
        public callServiceResponse()
        {
        }
        
        public callServiceResponse(gfsbiz.callServiceResponseBody Body)
        {
            this.Body = Body;
        }
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.Runtime.Serialization.DataContractAttribute(Namespace="")]
    public partial class callServiceResponseBody
    {
        
        [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
        public string response;
        
        public callServiceResponseBody()
        {
        }
        
        public callServiceResponseBody(string response)
        {
            this.response = response;
        }
    }
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    public interface EcChannel : gfsbiz.Ec, System.ServiceModel.IClientChannel
    {
    }
    
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
    public partial class EcClient : System.ServiceModel.ClientBase<gfsbiz.Ec>, gfsbiz.Ec
    {
        
        /// <summary>
        /// 实现此分部方法，配置服务终结点。
        /// </summary>
        /// <param name="serviceEndpoint">要配置的终结点</param>
        /// <param name="clientCredentials">客户端凭据</param>
        static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
        
        public EcClient() : 
                base(EcClient.GetDefaultBinding(), EcClient.GetDefaultEndpointAddress())
        {
            this.Endpoint.Name = EndpointConfiguration.EcSOAP.ToString();
            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
        }
        
        public EcClient(EndpointConfiguration endpointConfiguration) : 
                base(EcClient.GetBindingForEndpoint(endpointConfiguration), EcClient.GetEndpointAddress(endpointConfiguration))
        {
            this.Endpoint.Name = endpointConfiguration.ToString();
            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
        }
        
        public EcClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : 
                base(EcClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
        {
            this.Endpoint.Name = endpointConfiguration.ToString();
            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
        }
        
        public EcClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(EcClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
        {
            this.Endpoint.Name = endpointConfiguration.ToString();
            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
        }
        
        public EcClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress)
        {
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<gfsbiz.callServiceResponse> gfsbiz.Ec.callServiceAsync(gfsbiz.callServiceRequest request)
        {
            return base.Channel.callServiceAsync(request);
        }
        
        public System.Threading.Tasks.Task<gfsbiz.callServiceResponse> callServiceAsync(string paramsJson, string appToken, string appKey, string customerId, string customerCode, string service)
        {
            gfsbiz.callServiceRequest inValue = new gfsbiz.callServiceRequest();
            inValue.Body = new gfsbiz.callServiceRequestBody();
            inValue.Body.paramsJson = paramsJson;
            inValue.Body.appToken = appToken;
            inValue.Body.appKey = appKey;
            inValue.Body.customerId = customerId;
            inValue.Body.customerCode = customerCode;
            inValue.Body.service = service;
            return ((gfsbiz.Ec)(this)).callServiceAsync(inValue);
        }
        
        public virtual System.Threading.Tasks.Task OpenAsync()
        {
            return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
        }
        
        public virtual System.Threading.Tasks.Task CloseAsync()
        {
            return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
        }
        
        private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
        {
            if ((endpointConfiguration == EndpointConfiguration.EcSOAP))
            {
                System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
                result.MaxBufferSize = int.MaxValue;
                result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
                result.MaxReceivedMessageSize = int.MaxValue;
                result.AllowCookies = true;
                return result;
            }
            throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
        }
        
        private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
        {
            if ((endpointConfiguration == EndpointConfiguration.EcSOAP))
            {
                return new System.ServiceModel.EndpointAddress("http://oms.gfsbiz.com.cn/default/svc/web-service");
            }
            throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration));
        }
        
        private static System.ServiceModel.Channels.Binding GetDefaultBinding()
        {
            return EcClient.GetBindingForEndpoint(EndpointConfiguration.EcSOAP);
        }
        
        private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
        {
            return EcClient.GetEndpointAddress(EndpointConfiguration.EcSOAP);
        }
        
        public enum EndpointConfiguration
        {
            
            EcSOAP,
        }
    }
}
