<%@ Language=VBScript %>

<% Option Explicit

	Response.CacheControl = "no-cache"
      Response.AddHeader "Pragma", "no-cache"
%>

<!--#include file="shared.asp"-->

<%

Response.Expires = 0

dim objTrafficApp
dim sData
dim lFreewayID
dim sDirection
dim verr

'*** if no parameters are sent in then return the parameter list
if Request.Form = "" and Request.QueryString = "" then
      Response.Write "Usage:" & "<br>"
      Response.Write "<li> Parameters: lFreewayID as long, sDirection as string" & "<br><br>"
      Response.Write "<li> Returns: String" & "<br><br>"
      Response.Write "<li> example - http://Trafficapp.InterKnowlogy.net/GetTraffic.asp?lFreewayID=1&sDirection=s" & "<br>"
      Response.End
end if

if Request.ServerVariables("request_method") = "POST" then
      lFreewayID = Request.Form("lFreewayID")
      sDirection = Request.Form("sDirection")
else
      lFreewayID = Request.QueryString("lFreewayID")
      sDirection = Request.QueryString("sDirection")
end if

sdata = ""
if not isnumeric(lFreewayID) then
      Response.ContentType = "text/html"
      Response.Write "<Error>Invalid datatype</Error>"
      Response.End
end if

set objTrafficApp = server.CreateObject("IKTrafficApp.cTrafficApp")
set sData = objTrafficApp.GetTraffic(lFreewayID, sDirection,verr)

Response.ContentType = "text/html"

if not sData is nothing then 
      Response.ContentType = "text/xml" 
      Response.write GetXMLStreamFromADORS(sData,false)
end if 

on error resume next

set objTrafficApp = nothing

%>
dim oProxy              'as object
dim hResult             'as boolean
dim sXML                'as string

const URI_SDL = "http://Trafficapp.InterKnowlogy.net/cTrafficApp.xml"
const icURI = = 1             'Schema location type (URI based)

set oProxy = server.CreateObject("ROPE.Proxy")
hResult = oProxy.LoadServicesDescription(icURI,URI_SDL)

if hResult <> false then
sXML = oProxy.GetStates()
. . .