EasyCFM.COM ColdFusion Forums / ASP to CFML / ASP convert to CFMX

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: ASP convert to CFMX

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

icanuck
05-26-2004 @ 7:54 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 39
Joined: May 2003

Hi,

This ASP code is the only example I can get, and I do not work with it. My form is to be processed in a .cfm page (asp example below), take those vars and request an xml response from another server...etc.

If someone could help in general terms, maybe pointing me to the proper CFMX tags to use to get this done (steps) that would be a great help. If I knew what processes were going on I have some xml resources here.

Thanks (code below)

------------------------------------------------

<% Response.Buffer=True %>
<%
Dim xml
Dim xsl
Dim template
Dim processor
Dim strXML

'Since the XML data format is in MM/DD/YYYY - string the dates together from the form input
arrivalDate = Request.Form("arrivalMonth") & "/" & Request.Form("arrivalDay") & "/" & Request.Form("arrivalYear")
departureDate = Request.Form("departureMonth") & "/" & Request.Form("departureDay") & "/" & Request.Form("departureYear")

resType = Request.Form("resType")
Set xml = Server.CreateObject("microsoft.XMLDOM")


strXML = "<HotelSessionRequest method='runHotelAvailabilityListQuery'><HotelAvailabilityListQuery>"


strXML = strXML & "<arrivalDate>" & arrivalDate & "</arrivalDate><departureDate>" & departureDate & "</departureDate><city>" & Request.Form("city"& "</city><stateProvince>"
& Request.Form("stateProvince") & "</stateProvince><country>" & Request.Form("country") & "</country><numberOfAdults>" & Request.Form("numberOfAdults")
& "</numberOfAdults><numberOfResults>" & Request.Form("numberOfResults") & "</numberOfResults>"


strXML = strXML & "</HotelAvailabilityListQuery></HotelSessionRequest>"
strencodedXML = Server.UrlEncode(strXML)
datatosend = "cid=1&resType=" & resType & "&xmlVersion=3&xml=" & strencodedXML


' Get Code
Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://www.northcountry.com/xml/iface.asp?",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send datatosend

Set xml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
xml.async = false
xml.loadXml(xmlhttp.responseText)


Set xsl = Server.CreateObject("MSXML2.FreeThreadedDOMDocument.3.0")
xsl.async = false
xsl.load (Server.MapPath("hotavail.xsl"))


Set template = Server.CreateObject("MSXML2.XSLTemplate")
template.stylesheet = xsl


set processor = template.createProcessor()
processor.input = xml

'SEND PARAMETERS TO THE XSL TO CONTINUE
'TO ACCESS THE PARAM'S IN THE XSL THE FORMAT AT TOP-LEVEL <xsl:param name="arrivalDate"/>
'arrivalDate is already in the asp
If usersession <> "" Then
processor.addParameter "usersession", usersession
End If
If arrivalDate <> "" Then
processor.addParameter "arrivalDate", arrivalDate
End If
'departureDate is already in the asp
If departureDate <> "" Then
processor.addParameter "departureDate", departureDate
End If
resType = Request.Form("resType")
If resType <> "" Then
processor.addParameter "resType", resType
End If
city = Request.Form("city")
If city <> "" Then
processor.addParameter "citysearch", city
End If
state = Request.Form("stateProvince")
If state <> "" Then
processor.addParameter "statesearch", state
End If
country = Request.Form("country")
If country <> "" Then
processor.addParameter "country", country
End If
numberOfAdults = Request.Form("numberOfAdults")
If numberOfAdults <> "" Then
processor.addParameter "numberOfAdults", numberOfAdults
End If
processor.transform()


'Here is the final transformation to the browser
Response.Write (processor.output)
Set xsl = Nothing
Set xml = Nothing
Set xmlhttp = Nothing
Set template = Nothing
%>




Website Designed and Developed by Pablo Varando.