Setup Requirements

To recreate this sample, make a new C# ASP.NET application within Visual Studio.NET. Then right click References in the Solution Explorer and select Add Web Reference. Then type http://www.saiasecure.com/webservice/shipment/soap.asmx for the URL and click the Go icon on the right. You should then see a list of methods in the window below. Next change the Web Reference Name to "Saia.Shipment" and click Add Reference.



Sample Application Code

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace CS
{
	/// 
	/// Summary description for WebForm1.
	/// 
	public class WebForm1 : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label2;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Element;
		protected System.Web.UI.WebControls.Label ResponseCode;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.Label Fault;
		protected System.Web.UI.WebControls.Label Label7;
		protected System.Web.UI.WebControls.Label Message;
		protected System.Web.UI.WebControls.Label CurrentStatus;
		protected System.Web.UI.WebControls.Label ConsigneeName;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label Description1;
		protected System.Web.UI.WebControls.Label Label9;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			System.Text.StringBuilder request = new System.Text.StringBuilder();
			Saia.Shipment.Shipment shipment = new Saia.Shipment.Shipment();

			request.Append("<GetByProNumber>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<ProNumber>463510000</ProNumber>");
			request.Append("</GetByProNumber>");

			// Below are examples of the other tracing request documents.
			
			/* GetByBLNumber
			request.Append("<GetByBLNumber>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<BLNumber>12345</BLNumber>");
			request.Append("<OriginZipcode>38101</OriginZipcode>");
			request.Append("<DestinationZipcode>70364</DestinationZipcode>");
			request.Append("</GetByBLNumber>");
			*/

			/* GetByPONumber
			request.Append("<GetByPONumber>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<PONumber>12345</PONumber>");
			request.Append("<OriginZipcode>38101</OriginZipcode>");
			request.Append("<DestinationZipcode>70364</DestinationZipcode>");
			request.Append("</GetByPONumber>");
			*/

			/* GetByShipperNumber
			request.Append("<GetByShipperNumber>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<ShipperNumber>12345</ShipperNumber>");
			request.Append("<OriginZipcode>38101</OriginZipcode>");
			request.Append("<DestinationZipcode>70364</DestinationZipcode>");
			request.Append("</GetByShipperNumber>");
			*/

			/* GetByPartnerNumber
			request.Append("<GetByPartnerNumber>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<PartnerSCAC>VITR</PartnerSCAC>");
			request.Append("<PartnerNumber>123456789</PartnerNumber>");
			request.Append("</GetByPartnerNumber>");
			*/

			try
			{
				string response = shipment.ProcessXML(request.ToString());

				System.Xml.XmlDocument xmlResponse = new System.Xml.XmlDocument();
				xmlResponse.LoadXml(response);

				// Note: These examples use SelectSingleNode() which accepts a string 
				// containing a XPath expression. This is a common way to retrieve a node 
				// from a small XML Document. 

				if (xmlResponse.SelectSingleNode("/Response/Code").InnerText != "")
				{
					// Add error handling code in case Saia responds 
					// with an Error Code

					this.ResponseCode.Text = xmlResponse.SelectSingleNode("/Response/Code").InnerText;
					this.Element.Text = xmlResponse.SelectSingleNode("/Response/Element").InnerText;
					this.Fault.Text = xmlResponse.SelectSingleNode("/Response/Fault").InnerText;
					this.Message.Text = xmlResponse.SelectSingleNode("/Response/Message").InnerText;
				}
				else
				{
					this.CurrentStatus.Text = xmlResponse.SelectSingleNode("/Response/CurrentStatus").InnerText;
					this.ConsigneeName.Text = xmlResponse.SelectSingleNode("/Response/Consignee/Name").InnerText;

					// Below is a sample of how to retrieve an array
					// using XPath and XML with SelectNodes(). 

					System.Xml.XmlNodeList Details = xmlResponse.SelectNodes("/Response/Details/DetailItem");
					
					foreach (System.Xml.XmlNode DetailItem in Details)
					{
						Description1.Text = DetailItem["Description"].InnerText;
						break;
					}
				}
			}
			catch
			{
				// Add error handling code in case your unable to connect 
				// to the Saia Website.
			}
	
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}


Disclaimer:

Saia Inc. authorizes the use of these Web Services solely to facilitate the exchange of information between Saia and the customer. Unauthorized use of Saia, Inc. Web Services and information is strictly prohibited. All services may be used for lawful purposes only. No warranty, express or implied, is given relating to the accuracy of content and Saia, Inc. does not accept any liability for error or omission.

Saia Inc. reserves the right to refuse or cancel these services at it’s sole discretion. If any terms or conditions are failed to be followed, results constitute grounds for immediate account deactivation.