예제 #1
0
        public Decimal GetMileage(string originPostalCode, string destinationPostalCode)
        {
            //
            Decimal miles = 0;
            RateWareXLPortTypeClient client = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    ShipmentLocale org = new ShipmentLocale();
                    org.postalCode  = originPostalCode;
                    org.countryCode = "USA";

                    ShipmentLocale dest = new ShipmentLocale();
                    dest.postalCode  = destinationPostalCode;
                    dest.countryCode = "USA";

                    Mileage mileage = new Mileage();
                    mileage.releaseVersion = "22";
                    mileage.routingType    = "P";
                    mileage.systemId       = 1;
                    mileage.origin         = org;
                    mileage.destination    = dest;

                    miles = (Decimal)client.Mileage(authToken, mileage);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(miles);
        }
예제 #2
0
        public ClassesAndWeightsResponse GetClassesAndWeights(DataModule dataModule)
        {
            //
            ClassesAndWeightsResponse classes = null;
            RateWareXLPortTypeClient  client  = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    classes = client.DataModuleValidClassesAndWeights(authToken, dataModule);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(classes);
        }
예제 #3
0
        public LinearRateShipmentResponse[] CalculateLinearRates(LinearRateShipmentRequest[] requests)
        {
            //
            LinearRateShipmentResponse[] response = null;
            RateWareXLPortTypeClient     client   = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    response = client.LinearRateShipmentMultiple(authToken, requests);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(response);
        }
예제 #4
0
        public DataModule[] GetAvailableTariffs()
        {
            //
            DataModule[]             tariffs = null;
            RateWareXLPortTypeClient client  = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    tariffs = client.AvailableTariffs(authToken);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(tariffs);
        }
예제 #5
0
        public DensityRateShipmentResponse CalculateDensityRates(DensityRateShipmentRequest request)
        {
            //
            DensityRateShipmentResponse response = null;
            RateWareXLPortTypeClient    client   = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    response = client.DensityRateShipment(authToken, request);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(response);
        }
예제 #6
0
        public LTLPointListResponse GetLTLPointList(LTLPointListRequest request)
        {
            //
            LTLPointListResponse     response = null;
            RateWareXLPortTypeClient client   = new RateWareXLPortTypeClient();

            try {
                AuthenticationToken authToken = getAuthenticationToken();
                if (client.isReady(authToken))
                {
                    response = client.LTLPointList(authToken, request);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(response);
        }