Exemple #1
0
        private static DomesticRemittanceByPartnerServiceClient createClient(Environment env)
        {
            DomesticRemittanceByPartnerServiceClient client;

            client = new DomesticRemittanceByPartnerServiceClient(getBinding(env), env.getEndpointAddress(SERVICE_NAME));

            if (env.needsClientCertificate())
            {
                client.ClientCredentials.ClientCertificate.Certificate = env.getClientCertificate();
            }

            if (env.needsHTTPBasicAuth())
            {
                client.ClientCredentials.UserName.UserName = env.getUser();
                client.ClientCredentials.UserName.Password = env.getPassword();
            }

            return(client);
        }
Exemple #2
0
        public static getBalanceResponse getBalance(Environment env, getBalance request)
        {
            DomesticRemittanceByPartnerServiceClient client = createClient(env);

            request.version = VERSION;

            using (new System.ServiceModel.OperationContextScope((System.ServiceModel.IClientChannel)client.InnerChannel))
            {
                System.Net.ServicePointManager.SecurityProtocol = env.getSecurityProtocol();

                System.ServiceModel.Web.WebOperationContext.Current.OutgoingRequest.UserAgent = "APIBanking.NET";


                IDictionaryEnumerator headers = env.getHeaders().GetEnumerator();
                while (headers.MoveNext())
                {
                    System.ServiceModel.Web.WebOperationContext.Current.OutgoingRequest.Headers.Add(headers.Key.ToString(), headers.Value.ToString());
                }

                getBalanceResponse response = client.getBalance(request);

                return(response);
            }
        }
        public static String getURL(Environment env)
        {
            DomesticRemittanceByPartnerServiceClient client = createClient(env);

            return(client.Endpoint.ListenUri.AbsoluteUri);
        }