Sample Application Code
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
Protected WithEvents Element As System.Web.UI.WebControls.Label
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents TerminalManager As System.Web.UI.WebControls.Label
Protected WithEvents ResponseCode As System.Web.UI.WebControls.Label
Protected WithEvents Label5 As System.Web.UI.WebControls.Label
Protected WithEvents Fault As System.Web.UI.WebControls.Label
Protected WithEvents Label7 As System.Web.UI.WebControls.Label
Protected WithEvents Message As System.Web.UI.WebControls.Label
Protected WithEvents Label9 As System.Web.UI.WebControls.Label
Protected WithEvents PickupNumber As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PickupRequest As System.Text.StringBuilder = New System.Text.StringBuilder
PickupRequest.Append("<Create>")
PickupRequest.Append("<UserID>Your User ID</UserID>")
PickupRequest.Append("<Password>Your Password</Password>")
PickupRequest.Append("<TestMode>Y</TestMode>")
PickupRequest.Append("<AccountNumber>0123456</AccountNumber>")
' Optional Pickup Location Data, if you do not
' specify these properties then the location data
' will be use from the Account Number.
'
'PickupRequest.Append("<CompanyName>TESTING NAME</CompanyName>")
'PickupRequest.Append("<Street>TESTING STREET</Street>")
'PickupRequest.Append("<Box>TESTING BOX</Box>")
'PickupRequest.Append("<City>LOS ANGELES</City>")
'PickupRequest.Append("<State>CA</State>>")
'PickupRequest.Append("<Zipcode>90001</Zipcode>")
PickupRequest.Append("<ContactName>TESTING CONTACT</ContactName>")
PickupRequest.Append("<ContactPhone>1234567890</ContactPhone>")
PickupRequest.Append("<PickupDate>2004-09-24</PickupDate>")
PickupRequest.Append("<ReadyTime>13:00:00</ReadyTime>")
PickupRequest.Append("<CloseTime>17:00:00</CloseTime>")
PickupRequest.Append("<SpecialInstructions>TESTING SPECIAL INSTRUCTIONS</SpecialInstructions>")
PickupRequest.Append("<Details>")
PickupRequest.Append("<DetailItem>")
PickupRequest.Append("<DestinationZipcode>70364</DestinationZipcode>")
PickupRequest.Append("<Pieces>5</Pieces>")
PickupRequest.Append("<Package>SK</Package>")
PickupRequest.Append("<Weight>100</Weight>")
PickupRequest.Append("<Freezable>N</Freezable>")
PickupRequest.Append("</DetailItem>")
PickupRequest.Append("</Details>")
PickupRequest.Append("</Create>")
Try
Dim http As System.Net.HttpWebRequest = System.Net.WebRequest.Create("http://www.saiasecure.com/webservice/pickup/xml.aspx")
http.Method = "POST"
http.ContentLength = PickupRequest.ToString().Length
http.ContentType = "text/xml"
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(http.GetRequestStream())
sw.Write(PickupRequest.ToString())
sw.Close()
Dim PickupResponse As String
Dim httpResponse As System.Net.HttpWebResponse = http.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(httpResponse.GetResponseStream())
PickupResponse = sr.ReadToEnd()
sr.Close()
Dim XmlResponse As System.Xml.XmlDocument = New System.Xml.XmlDocument
XmlResponse.LoadXml(PickupResponse)
If XmlResponse.SelectSingleNode("/Response/Code").InnerText <> "" Then
' Add error handling code in case Saia responds
' with an Error Code
Me.ResponseCode.Text = XmlResponse.SelectSingleNode("/Response/Code").InnerText
Me.Element.Text = XmlResponse.SelectSingleNode("/Response/Element").InnerText
Me.Fault.Text = XmlResponse.SelectSingleNode("/Response/Fault").InnerText
Me.Message.Text = XmlResponse.SelectSingleNode("/Response/Message").InnerText
Else
Me.PickupNumber.Text = XmlResponse.SelectSingleNode("/Response/PickupNumber").InnerText
Me.TerminalManager.Text = XmlResponse.SelectSingleNode("/Response/PickupTerminal/Manager").InnerText
End If
Catch
' Add error handling code in case your unable to connect
' to the Saia Website.
End Try
End Sub
End Class
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.