public static PrimeSuiteServiceClient GetServiceClient(string IP)
        {
            string sMethodFullName = "Services." + System.Reflection.MethodBase.GetCurrentMethod().Name;

            try
            {

                string sIP = IP;
                string sServiceURL = "http://" + sIP + "/PrimeSuiteAPI/APIv1.0/PrimeSuiteAPI.svc";
                System.ServiceModel.EndpointAddress oEndpointAddress = new System.ServiceModel.EndpointAddress(sServiceURL);
                System.ServiceModel.BasicHttpBinding oBasicBinding = new System.ServiceModel.BasicHttpBinding();

                    oBasicBinding.ReaderQuotas.MaxStringContentLength = 2147483647;
                    //"5242880" = 5MB
                    oBasicBinding.ReaderQuotas.MaxDepth = 2147483647;
                    oBasicBinding.ReaderQuotas.MaxArrayLength = 2147483647;
                    oBasicBinding.ReaderQuotas.MaxBytesPerRead = 2147483647;
                    oBasicBinding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
                    oBasicBinding.MaxBufferSize = 2147483647;
                    oBasicBinding.MaxReceivedMessageSize = 2147483647;

                PrimeSuiteServiceClient client = new PrimeSuiteServiceClient(oBasicBinding, oEndpointAddress);
                ModifyDataContractSerializerBehavior(client.Endpoint);
                return (client);
            }
            catch (Exception ex)
            {
                //Throw New Exception("Error in " & sMethodFullName & ":" & vbNewLine & ex.Message & vbNewLine)
                throw ex;
            }
        }
 public static void CloseServiceClient(PrimeSuiteServiceClient oClient)
 {
     if ((oClient != null))
     {
         if (oClient.State == System.ServiceModel.CommunicationState.Opened)
         {
             oClient.Close();
         }
     }
 }