// -------------------------------------------------------------------------- // The process of generating a shipping label is very simple. // In fact, here are the 3 simple steps: // 1. Assign your credentials and shipping parameters. // 2. Add package(s) // 3. Submit // For purposes of simpler illustration, some property assignments have been omitted // -------------------------------------------------------------------------- using EMXShipping; // Instantiate the component EMXShip my_label = new EMXShip(); // Step 1 of 3 my_label.AccessLicenseNumber = "YOUR VALUE HERE"; my_label.UserId = "YOUR VALUE HERE"; my_label.Password = "MY-PASSWORD"; my_label.ShipperNumber = "YOUR VALUE HERE"; my_label.AccountNumber = "YOUR VALUE HERE"; // Assign Shipper info my_label.ShipperName = "YOUR VALUE HERE"; my_label.ShipperAddressLine1 = "YOUR VALUE HERE"; my_label.ShipperCity = "YOUR VALUE HERE"; my_label.ShipperStateProvinceCode = "YOUR VALUE HERE"; my_label.ShipperPostalCode = "YOUR VALUE HERE"; my_label.ShipperCountryCode = "YOUR VALUE HERE"; // Assign Ship-To info my_label.ShipToCompanyName = "YOUR VALUE HERE"; my_label.ShipToAttentionName = "YOUR VALUE HERE"; my_label.ShipToAddressLine1 = "YOUR VALUE HERE"; my_label.ShipToCity = "YOUR VALUE HERE"; my_label.ShipToStateProvinceCode = "YOUR VALUE HERE"; my_label.ShipToPostalCode = "YOUR VALUE HERE"; my_label.ShipToCountryCode = "YOUR VALUE HERE"; // Subfolder where you want to save your label files. my_label.LabelImage_Path = Server.MapPath("./Labels/"); my_label.WillCreateLabelImageFile = true; my_label.WillCreateLabelHtmlFile = true; my_label.LabelImageFormatCode = "GIF"; // can be PNG, or EPL, SPL for printing to thermal printers my_label.LabelPrintMethodCode = "GIF"; // Easily switch between Customer Integration Environment (CIE) mode or LIVE PRODUCTION mode. my_label.LIVE_mode = false; // Step 2 of 3 // Now add your package(s) UPackage my_pkg1 = new UPackage(); my_pkg1.PackageWeight = "YOUR VALUE HERE"; my_pkg1.PackageReferenceNumberValue = "YOUR VALUE HERE"; my_pkg1.PackageServiceOptionsInsuredMonetaryValue = "YOUR VALUE HERE"; my_label.ShipAdd_Package(my_pkg1); // Create/Add more packages here if necessary.. // Step 3 of 3 // After adding your packages, now we're ready to "ShipSubmit" my_label.ShipSubmit(); // Was there an error? if (my_label.error_code != 0) { Error_Message.Text = my_label.error_description; } else { // Display summary results: response.write "Shipment ID Number:" + my_label.ShipmentIdentificationNumber; response.write "Total Charges: " + my_label.TotalChargesMonetaryValue; response.write "Negotiated rates: " + = my_label.NegotiatedRatesNetSummaryChargesGrandTotalMonetaryValue; response.write "Total Weight: " + = my_label.BillingWeight; // Display the package results: for (i = 0; i < my_label.PackagesResultsCount; i++) { response.write "Package Tracking No.: " + my_label.PackageResultsList[i].TrackingNumber + "." + my_label.LabelImageFormatCode; response.write "Location of generated label image: " + my_label.PackageResultsList[i].LabelFullImagePath; response.write "Location of generated HTML file: " + my_label.PackageResultsList[i].LabelFullHTMLPath; } /* ------------------------------------------------------------------------ * Display other technical info. You won't need these extra information during typical * shipping transactions. You will use them for your CERTIFICATION requirements with UPS. * These info will also help you in further understanding what goes on in the process * and for debugging information. * ------------------------------------------------------------------------ * */ TextBoxConfirmRequest.Text = my_label.xml_confirm_request; TextBoxConfirmResponse.Text = my_label.xml_confirm_response; TextBoxAcceptRequest.Text = my_label.xml_accept_request; TextBoxAcceptResponse.Text = my_label.xml_accept_response;