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/ratequote/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.RateQuote" 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
{
	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 Label4;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.Label TotalInvoice;
		protected System.Web.UI.WebControls.Label Rate1;
		protected System.Web.UI.WebControls.Label OriginManager;
		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.RateQuote.RateQuote rateQuote = new Saia.RateQuote.RateQuote();

			request.Append("<Create>");
			request.Append("<UserID>Your User ID</UserID>");
			request.Append("<Password>Your Password</Password>");
			request.Append("<TestMode>Y</TestMode>");
			request.Append("<BillingTerms>Prepaid</BillingTerms>");
			request.Append("<AccountNumber>0123456</AccountNumber>");
			
			// Outbound
			request.Append("<Application>Outbound</Application>");
			request.Append("<DestinationCity>LOS ANGELES</DestinationCity>");
			request.Append("<DestinationState>CA</DestinationState>");
			request.Append("<DestinationZipcode>90001</DestinationZipcode>");

			/* Inbound
			request.Append("<Application>Inbound</Application>");
			request.Append("<OriginCity>LOS ANGELES</OriginCity>");
			request.Append("<OriginState>CA</OriginState>");
			request.Append("<OriginZipcode>90001</OriginZipcode>");
			*/

			/* ThirdParty
			request.Append("<Application>ThirdParty</Application>");
			request.Append("<OriginCity>HOUMA</OriginCity>");
			request.Append("<OriginState>LA</OriginState>");
			request.Append("<OriginZipcode>70364</OriginZipcode>");
			request.Append("<DestinationCity>LOS ANGELES</DestinationCity>");
			request.Append("<DestinationState>CA</DestinationState>");
			request.Append("<DestinationZipcode>90001</DestinationZipcode>");
			*/

			request.Append("<Details>");
			request.Append("<DetailItem>");
			request.Append("<Weight>100</Weight>");
			request.Append("<Class>50</Class>");
			request.Append("</DetailItem>");
			request.Append("</Details>");

			request.Append("<Accessorials>");
			request.Append("<AccessorialItem>");
			request.Append("<Code>LiftgateService</Code>");
			request.Append("</AccessorialItem>");
			request.Append("</Accessorials>");

			request.Append("</Create>");

			try
			{
				string response = rateQuote.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.TotalInvoice.Text = xmlResponse.SelectSingleNode("/Response/TotalInvoice").InnerText;
					this.OriginManager.Text = xmlResponse.SelectSingleNode("/Response/OriginTerminal/Manager").InnerText;

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

					System.Xml.XmlNodeList RateDetails = xmlResponse.SelectNodes("/Response/RateDetails/RateDetailItem");
					
					foreach (System.Xml.XmlNode RateDetailItem in RateDetails)
					{
						Rate1.Text = RateDetailItem["Rate"].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.