Frontier 5 and XML: RPC Test Script
This is a fat page containing a test script that calls the XML server running on the LAN at www.scripting.com.
It's designed to run in Frontier 5/Win, but it can easily be adapted to run in any other HTTP-aware programming environment.
In fact, with Alan German's help, I just adapted it to run in the Mac version of Frontier 5.
Listing
local (server = "206.204.24.10") |
local (query = string (workspace.xmltest.query)) |
bundle //build the HTTP request |
| command = command + s + "\r\n" |
| add ("POST /xmlGateway HTTP/1.0") |
| add ("User-Agent: Frontier/" + Frontier.version () + " (" + sys.os () + ")") |
| add ("Content-Type: text/xml") |
| add ("Content-length: " + sizeOf (query)) |
local (stream = tcp.openStream (server, port)) |
wp.newtextobject (command, @workspace.xmltest.command) |
tcp.writeStream (stream, command) |
local (timeout = clock.ticks () + (60 * 3)) |
| case tcp.statusStream (stream, @bytespending) |
| s = s + tcp.readStream (stream, bytespending) |
| if clock.ticks () > timeout |
wp.newtextobject (s, @workspace.xmltest.queryResult) |
edit (@workspace.xmltest.queryResult) |
Query
As you can see, it's just an HTTP client.
Here's the HTTP request it sends:
POST /xmlGateway HTTP/1.0
User-Agent: Frontier/5.0b5 (WinNT)
Host: 206.204.24.10
Content-Type: text/xml
Content-length: 300
<?XML VERSION="1.0"?>
<remoteProcedureCall>
<header>
<rpcVersion>1.0a1</rpcVersion>
<docs>http://www.scripting.com/frontier5/xml/rpc/</docs>
</header>
<procedureName>getStateName</procedureName>
<param>
<name>stateNum</name>
<value>14</value>
</param>
</remoteProcedureCall>
|
© Copyright 1996-97 UserLand Software. This page was last built on 1/15/98; 5:02:56 PM.
It was originally posted on 1/14/98; 2:12:38 PM.
Webmaster: dave@scripting.com.
|