------------------------------------------------------------------------------------- <!--- Con-way XML Interface Sample Code for ColdFusion - Shipment Status Tracking This code will run fine on ColdFusion MX, but not on CF5 ----------------- TODO: * replace the USERNAME and PASSWORD String values in <cfset>s below with your Con-way username and password * Also add PRO Number(s), as desired ----------------- Send questions to our Web Customer Support at web.support@Con-way.com ---> <!--- Declare Constants ---> <cfset title = "Shipment Status Tracking" /> <cfset conwayXmlUrl = "https://www.Con-way.com/XMLj/X-ShipmentStatus" /> <cfset requestType = "ShipmentStatusRequest" /> <cfset responseType = "ShipmentStatusResponse" /> <cfset myElement = "DeliveredDate" /> <cfset myElementPath = "/" & responseType & "/" & myElement /> <cfset myErrorElement = "/" & responseType & "/" & "Error" /> <!--- replace the "USERNAME" & "PASSWORD" String values with your Con-way username and password. *** Also add a valid CustRefNbr value in <cfset> element below ---> <cfset username = "USERNAME" /> <cfset password = "PASSWORD" /> <!-- Shipment Status Request XML. In actual use, you would use your own Customer Reference Numbers For this sample we will just hard code some dummy data. ---> <cfset trackNum = "591083813" /> <cfset today = DateFormat(now(), "mm/dd/yy")> <cfset xmlRequest = "<ShipmentStatusRequest testmode=""Y"">" & "<CustRefNbr>" & #tracknum# & "</CustRefNbr>" & "</ShipmentStatusRequest>" /> <!-- Call the Con-way XML Shipment Status Servlet ---> <cfhttp method="post" url="#conwayXmlUrl#" username="#username#" password="#password#"> <cfhttpparam name="#requestType#" value="#xmlRequest#" type="formfield" /> </cfhttp> <!-- Parse the XML Response and create a DOM Document ---> <cfset xmlResponse = xmlParse(cfhttp.fileContent) /> <!-- Look for the desired tag(s) in the DOM Document ---> <!--- If RateQuote was not successful, get the Error message instead ---> <cfscript> responses = XmlSearch(xmlResponse,myElementPath); if (ArrayLen(responses) EQ 0) responses = XmlSearch(xmlResponse,myErrorElement); response = "#myElement# = " & responses [1].XmlText; </cfscript> <!-- The END !!! Now we can display the result of this test ---> <HTML> <HEAD> <TITLE>Sample ColdFusion MX for Con-way XML <cfoutput>#title#</cfoutput></TITLE> </HEAD> <BODY> <CENTER> <B><FONT face="arial" size=+1><I>Sample ColdFusion MX for Con-way XML <cfoutput>#title#</cfoutput></I></FONT></B> </CENTER> <br> <!-- Print the Tag value we extracted from the XML response ---> <b><font face="Arial, Helvetica, sans-serif"> This is the value of the &lt;<cfoutput>#myElement#</cfoutput>&gt; element we extracted from the XML response: <cfoutput> #response#</font></B> </cfoutput> <br><br> <b><font face="Arial, Helvetica, sans-serif"> This is the complete XML response output for Con-way XML <cfoutput>#title#</cfoutput>:</font></b> <br> <!-- XML dump of the response from the Con-way XML Servlet ---> <cfdump var="#xmlResponse#"> </BODY> </HTML> -------------------------------------------------------------------------------------