示例#1
0
#!/usr/local/bin/python
import os
import cgi, cgitb
import Cookie
from bu_xmlgateway.xmlgateway import VendorRequest

BU_SESSION_COOKIE_NAME = "bu_session"
cookie = Cookie.SimpleCookie(os.environ["HTTP_COOKIE"])
try:
    test = cookie["__utma"].value
    session = cookie[BU_SESSION_COOKIE_NAME].value
except (Cookie.CookieError, KeyError):
    session = ""

# instantiate object
request = VendorRequest()
request.setUrl("http://www-devl.bu.edu/link/bin/uiscgi_shared_xml.pl")
request.setSession(session)

form = cgi.FieldStorage()
request.setParameter('ModuleName', form.getvalue('ModuleName'))
request.setSyncUrl('')
response = request.getResponse()
session1 = response.getSession()
cookie[BU_SESSION_COOKIE_NAME] = session1
cookie[BU_SESSION_COOKIE_NAME]["domain"] = ".bu.edu"
cookie[BU_SESSION_COOKIE_NAME]["path"] = "/"
print cookie.output()

if request.isError():
    errorMsg = request.getErrorMsg()
示例#2
0
#!/usr/local/bin/python
import os
import cgi, cgitb
import Cookie
from bu_xmlgateway.xmlgateway import VendorRequest
BU_SESSION_COOKIE_NAME = "bu_session"
cookie = Cookie.SimpleCookie(os.environ["HTTP_COOKIE"])
try:
	test = cookie["__utma"].value
	session =  cookie[BU_SESSION_COOKIE_NAME].value
except (Cookie.CookieError, KeyError):
    session = ""

# instantiate object
request = VendorRequest()
request.setUrl("http://www-devl.bu.edu/link/bin/uiscgi_shared_xml.pl")
request.setSession(session)

form = cgi.FieldStorage() 
request.setParameter('ModuleName', form.getvalue('ModuleName'));
request.setSyncUrl('')
response = request.getResponse()
session1 = response.getSession()
cookie[BU_SESSION_COOKIE_NAME] = session1
cookie[BU_SESSION_COOKIE_NAME]["domain"] = ".bu.edu"
cookie[BU_SESSION_COOKIE_NAME]["path"] = "/"
print cookie.output()


if request.isError() :
	errorMsg = request.getErrorMsg()
示例#3
0
#!/usr/local/bin/python
import os
import cgi, cgitb
from bu_xmlgateway.xmlgateway import VendorRequest
request = VendorRequest()

request.setUrl("http://www-devl.bu.edu/link/bin/uiscgi_demo_xmlgateway_xml.pl")
request.setParameter("ModuleName", "get_building.pl")

form = cgi.FieldStorage()
buildingCd = form.getvalue('BuildingCd')
request.setParameter('BuildingCd', buildingCd)
#request.setParameter('BuildingCd', 'MET');
response = request.getResponse()
print "Content-type: text/html"
print
if request.isError():
    errorMsg = request.getErrorMsg()
    print "<h3>System Error</h3>%s \n" % errorMsg
elif response.getType() == 'DATA':
    buildingName = response.getParameter('BuildingName')
    buildingLoc = response.getParameter('BuildingLoc')
    print """<html>
		<head><title>Building Description(Python)</title></head>
			<body>
				<h3>BUILDING DESCRIPTION(Python)</h3>				<hr>
				<form action="scenario_1.py" method="POST">
					Building Code:       <input type="text" name="BuildingCd" value="%s">
					<input type="submit" value="Send">
				</form>
				<p>Building Name: <b>%s</b></p>
示例#4
0
#!/usr/local/bin/python
import os
import cgi, cgitb
from bu_xmlgateway.xmlgateway import VendorRequest
request = VendorRequest()

request.setUrl("http://www-devl.bu.edu/link/bin/uiscgi_demo_xmlgateway_xml.pl")
request.setParameter("ModuleName", "get_building.pl")

form = cgi.FieldStorage()
buildingCd = form.getvalue('BuildingCd')
request.setParameter('BuildingCd', buildingCd);
#request.setParameter('BuildingCd', 'MET');
response = request.getResponse()
print "Content-type: text/html"
print
if request.isError() :
	errorMsg = request.getErrorMsg()       
	print "<h3>System Error</h3>%s \n" % errorMsg
elif response.getType() == 'DATA':
	buildingName	= response.getParameter('BuildingName')
	buildingLoc	= response.getParameter('BuildingLoc')
	print """<html>
		<head><title>Building Description(Python)</title></head>
			<body>
				<h3>BUILDING DESCRIPTION(Python)</h3>				<hr>
				<form action="scenario_1.py" method="POST">
					Building Code:       <input type="text" name="BuildingCd" value="%s">
					<input type="submit" value="Send">
				</form>
				<p>Building Name: <b>%s</b></p>