Personal tools

LPS server API

From OpenLaszlo

Contents

LPS server API

Documents the HTTP APIs used by the LPS server.

All implementations should proxy HTTP headers for both client requests and server responses.

Requests for Application Presentation

lzr=dhtml

loads the application compiled for the dhtml runtime, with the developer's console.

lzr=swf7
lzr=swf8

loads the application compiled for the swf7 or swf8 runtime, with the developer's console

lzt=both

display swf and dhtml runtimes side by side

lzt=lfc

return the compiled lfc (?)

lzt=clearcache

clears out all of the server caches, but not the browser's caches

lzt=svgwrapper

server SVG wrapper (goes with lzr=svg)

lzt=canvas

Returns the app canvas and compilation options/information as XML

XML Data Requests

Example Request

http://localhost:8080/legals/examples/components/style_example.lzx?lzt=xmldata&reqtype=GET&sendheaders=false&trimwhitespace=false&nsprefix=false&url=http%3A//www.laszlosystems.com/cgi-pub/weather.cgi%3Fzip%3D30622&timeout=30000&cache=false&ccache=undefined&__lzbc__=1165258182993

Request Query Arguments

http://localhost:8080/legals/examples/components/style_example.lzx

Data should be loaded relative to this URL

lzt=xmldata

XML data should be loaded

reqtype=GET

Use HTTP GET as the protocol for the request

sendheaders=false

Whether or not HTTP headers should to be sent to the client (setting to true affects server caching performance)

trimwhitespace=false

Whether or not to trim whitespace from the XML

nsprefix=false

Specifies a namespace prefix

url=http%3A//www.laszlosystems.com/cgi-pub/weather.cgi%3Fzip%3D30622

URL to load data from

timeout=30000

Maximum amount of time to wait

cache=false

Cache on the server

ccache=undefined

Cache on the client

__lzbc__=1165258182993

Ignore this cache-buster.

Return Format

All requests are returned as XML in the following format:

<resultset>
<body>
... XML response body ...
</body>
<headers>
... HTTP headers, if sendheaders is set to true...
</headers>
</resultset>

For example, this URL http://localhost:8080/legals/examples/components/style_example.lzx?lzt=xmldata&reqtype=GET&sendheaders=false&trimwhitespace=false&nsprefix=false&url=http%3A//www.laszlosystems.com/cgi-pub/weather.cgi%3Fzip%3D30622&timeout=30000&cache=false&ccache=undefined&__lzbc__=1165258182993

Returns:

<resultset>
<body>
<weather sourceurl="http://www.srh.noaa.gov/zipcity.php?inputstring=30622">
	<forecast>
		<day label="TODAY" imageurl="http://www.srh.noaa.gov/ifps/text/images/fzra100.jpg" desc="Freezing Rain" temp="Hi  38°F "/>
		<day label="Tonight " imageurl="http://www.srh.noaa.gov/ifps/text/images/nbkn.jpg" desc="Gradual Clearing" temp="Lo  29°F "/>
		<day label="Friday " imageurl="http://www.srh.noaa.gov/ifps/text/images/few.jpg" desc="Mostly Sunny" temp="Hi  51°F "/>
		<day label="Friday Night" imageurl="http://www.laszlosystems.com:80/weather/images/nsct.jpg" desc="Partly Cloudy" temp="Lo  30°F "/>
		<day label="Saturday " imageurl="http://www.srh.noaa.gov/ifps/text/images/ra20.jpg" desc="Slight Chc Rain" temp="Hi  48°F "/>
		<day label="Saturday Night" imageurl="http://www.srh.noaa.gov/ifps/text/images/nra60.jpg" desc="Rain Likely" temp="Lo  34°F "/>
		<day label="Sunday " imageurl="http://www.srh.noaa.gov/ifps/text/images/ra40.jpg" desc="Chance Rain" temp="Hi  39°F "/>
		<day label="Sunday Night" imageurl="http://www.srh.noaa.gov/ifps/text/images/nfew.jpg" desc="Mostly Clear" temp="Lo  32°F "/>
		<day label="Monday " imageurl="http://www.srh.noaa.gov/ifps/text/images/few.jpg" desc="Mostly Sunny" temp="Hi  47°F "/>
	</forecast>
	<current>
		<windspeed>Calm</windspeed>
		<when>Dec 15, 6:41 am EST</when>
		<dewpoint>32°F (0°C)</dewpoint>
		<station>Winder-Barrow Airport</station>
		<barometer>29.95"</barometer>
		<where>Bogart, GA 

</where>
		<temp>32°F</temp>
		<desc>Overcast</desc>
		<heatindex>None</heatindex>
		<humidity>100 %</humidity>
	</current>
	<radar src="http://www.laszlosystems.com:80/weather/small/kffc.jpg"/>
	<satellite src="http://www.laszlosystems.com:80/weather/thumbs/ECI8.JPG"/>
</weather>
</body>
<headers>
</headers></resultset>

HTTP response headers

If sendheaders is set to true, HTTP response headers will be returned in the following format:

<headers>
<header name="header name" value="header value" />
<header name="header name" value="header value" />
...
</headers>

For example, this URL: http://localhost:8080/legals/examples/components/style_example.lzx?lzt=xmldata&reqtype=GET&sendheaders=true&trimwhitespace=false&nsprefix=false&url=http%3A//www.laszlosystems.com/cgi-pub/weather.cgi%3Fzip%3D30622&timeout=30000&cache=false&ccache=undefined&__lzbc__=1165258182993

Returns:

<resultset>
<body>
<weather sourceurl="http://www.srh.noaa.gov/zipcity.php?inputstring=30622">
	<forecast>
		<day label="TODAY" imageurl="http://www.srh.noaa.gov/ifps/text/images/fzra100.jpg" desc="Freezing Rain" temp="Hi  38°F "/>
		<day label="Tonight " imageurl="http://www.srh.noaa.gov/ifps/text/images/nbkn.jpg" desc="Gradual Clearing" temp="Lo  29°F "/>
		<day label="Friday " imageurl="http://www.srh.noaa.gov/ifps/text/images/few.jpg" desc="Mostly Sunny" temp="Hi  51°F "/>
		<day label="Friday Night" imageurl="http://www.laszlosystems.com:80/weather/images/nsct.jpg" desc="Partly Cloudy" temp="Lo  30°F "/>
		<day label="Saturday " imageurl="http://www.srh.noaa.gov/ifps/text/images/ra20.jpg" desc="Slight Chc Rain" temp="Hi  48°F "/>
		<day label="Saturday Night" imageurl="http://www.srh.noaa.gov/ifps/text/images/nra60.jpg" desc="Rain Likely" temp="Lo  34°F "/>
		<day label="Sunday " imageurl="http://www.srh.noaa.gov/ifps/text/images/ra40.jpg" desc="Chance Rain" temp="Hi  39°F "/>
		<day label="Sunday Night" imageurl="http://www.srh.noaa.gov/ifps/text/images/nfew.jpg" desc="Mostly Clear" temp="Lo  32°F "/>
		<day label="Monday " imageurl="http://www.srh.noaa.gov/ifps/text/images/few.jpg" desc="Mostly Sunny" temp="Hi  47°F "/>
	</forecast>
	<current>
		<windspeed>Calm</windspeed>
		<when>Dec 15, 6:41 am EST</when>
		<dewpoint>32°F (0°C)</dewpoint>
		<station>Winder-Barrow Airport</station>
		<barometer>29.95"</barometer>
		<where>Bogart, GA 

</where>
		<temp>32°F</temp>
		<desc>Overcast</desc>
		<heatindex>None</heatindex>
		<humidity>100 %</humidity>
	</current>
	<radar src="http://www.laszlosystems.com:80/weather/small/kffc.jpg"/>
	<satellite src="http://www.laszlosystems.com:80/weather/thumbs/ECI8.JPG"/>
</weather>
</body>
<headers>
<header name="Date" value="Mon, 04 Dec 2006 19:24:21 GMT" /><header name="Server" value="Apache/2.0.54 (Mandriva Linux/PREFORK-13mdk)" /></headers></resultset>

Exceptions

Server-side errors and exceptions are returned in this format:

<resultset>
<error status="2" msg="unknown host for http://www.laszlostems.com/cgi-pub/weather.cgi?zip=30622: www.laszlostems.com"/>
</resultset>

The status attribute contains the error status pre. The msg attribute contains a human-readible version of the error. For example, this URL: http://localhost:8080/legals/examples/components/style_example.lzx?lzt=xmldata&reqtype=GET&sendheaders=false&trimwhitespace=false&nsprefix=false&url=http%3A//www.laszlystems.com/cgi-pub/weather.cgi%3Fzip%3D30622&timeout=30000&cache=false&ccache=undefined&__lzbc__=1165258182993

Returns the following:

<resultset>
<error status="2" msg="unknown host for http://www.laszlostems.com/cgi-pub/weather.cgi?zip=30622: www.laszlostems.com"/>
</resultset>