ASP XML Quote Request Example
This sample demonstrates how to send and receive an XML quote request to Jet Delivery’s API using classic ASP.
Note: This example assumes your server is running Microsoft IIS 5.0 or higher.
client.asp
Paste the following code into a file named client.asp:
<%
' ASP Sample: Send XML Quote Request to Jet Delivery
Origin = CStr(Request("Origin"))
Destination = CStr(Request("Destination"))
Pieces = CStr(Request("Pieces"))
Weight = CStr(Request("Weight"))
Service = CStr(Request("Service"))
PickupDate = CStr(Request("PickupDate"))
PickupTime = CStr(Request("PickupTime"))
rspwntype = CStr(Request("rspwntype"))
strXML = "<?xml version='1.0' encoding='UTF-8'?>" & _
"<XMLST xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" & _
"<RequestHeader><xmlsacn>44710</xmlsacn><xmlsuid>446546456</xmlsuid></RequestHeader>" & _
"<Quote><PickupZip>" & Origin & "</PickupZip><DeliverZip>" & Destination & "</DeliverZip>" & _
"<Pieces>" & Pieces & "</Pieces><Weight>" & Weight & "</Weight><ServiceType>" & Service & "</ServiceType>" & _
"<VehicleType>TRK</VehicleType><Pickupdate>" & xmlDate(PickupDate) & "</Pickupdate>" & _
"<Pickuptime>" & PickupTime & "</Pickuptime><Deliverdate>" & xmlDate(PickupDate) & "</Deliverdate>" & _
"</Quote></XMLST>"
Set objXMLhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLhttp.Open "POST", "https://rest.jetdelivery.com/xml/data/index.asp?action=quote", False
objXMLhttp.setRequestHeader "Content-type", "application/xml"
objXMLhttp.Send strXML
Response.ContentType = "text/html"
Response.Write objXMLhttp.responseText
Function xmlDate(inVar)
If IsDate(inVar) Then
Dim m, d
m = Right("0" & Month(inVar), 2)
d = Right("0" & Day(inVar), 2)
xmlDate = Year(inVar) & "-" & m & "-" & d
Else
xmlDate = ""
End If
End Function
%>
Tip: Replace xmlsacn / xmlsuid with your assigned credentials.