*/ Connect to other onlines and display startup date/time */ and number of currently logged on users. */ Client talks with an apsy called STATUSMON, the code */ for which resides as STATUS****** procedures in file */ TOOLS. To make this work you need two web rules, one */ to make this page work... something like: */ JANUS WEB [port] ON /DEMO/* OPEN FILE JANWEB CMD 'I *' */ And another one so this page can communicate over http */ with the server program. Something like: */ JANUS WEB [port] ON /WEBSTATUSMON/* CMD 'STATUSMON *' UTABLE LPDLST 4000 Begin %dt is string len 20 %host is string len 20 %msg is string len 132 array(3) %port is string len 4 array(12) %test is float %z is float %doc Object XmlDoc %n Object XmlNode %m Object XmlNode %req Object HttpRequest %resp Object HttpResponse %test = 0 %dt = $Web_Date + (30 * 24 * 60 * 60) Call $Web_On Call $Web_Type('TEXT/HTML') Call $Web_Sub('@@') Call $Web_Expire($Web_Date - 1) Call $Web_Response('PRAGMA', 'NO-CACHE') %host = 'sirius.sirius-software.com' %port(1) = 80 %port(2) = 9703 %port(3) = 9702 %port(4) = 9700 %port(5) = 9609 %port(6) = 9608 %port(7) = %port(8) = %port(9) = %port(10) = * Build the XML request. %req = New %doc = New %n = %doc:AddElement('soap:Envelope', , 'http://schemas.xmlsoap.org/soap/envelope/') %n = %n:AddElement('soap:Body') %n = %n:AddElement('StatRequest') %m = %n:AddElement('Stat', 'NLOGON') %m = %n:AddElement('Stat', 'CPU') * Start the HTML page to display results. In file JANWEB include WEB/TEMPLATE_TOP Html

Janus SOAP and Sockets Demo

This page is a demonstration program for Janus Sockets and Janus SOAP. Janus Sockets is a product that provides socket connectivity between Model 204 and many other tcp/ip bases services. Sockets are the low-level connection underlying http, ftp, telnet and most other internet services. SOAP (Simple Object Access Protocol) is a stateless, one-way message exchange paradigm on which more complex interactions can also be built. SOAP envelopes contain XML InfoSets, and much of the Janus SOAP API is centered on structuring XML documents.

The program that generates this page opens socket connections to other 204 onlines at Sirius Software to check whether they're running. The remote online responds by sending a short XML document via Janus SOAP. The XML is parsed, also via Janus SOAP functions, and the information is presented here:

End Html * Connect to each online and get status. TOPT: For %z from 1 to 5 * Build and post the request to each port in the %port * array, using HTTPHelper methods. %req:host = 'sirius-software.com' %req:port = %port(%z) * Note: The remote server needs a rule to handle this page request. %req:page = '/webstatusmon/main.html' %req:AddXml(%doc) %req:AddHeader('Content-Type', 'text/xml') $web_off %resp = %req:Post('SOAP',0) $web_on If %port(%z) eq 80 Then Html Data Else Html Data End If If %resp eq Null Then Html Data Loop Next End If * Grab the returned info %doc = New * %doc:print If %resp:ParseXML(%doc, 'ErrRet') Then Html Data Loop Next End If * If not %doc:SelectCount('//stat') Then If %doc:SelectSingleNode('//stat') eq Null Then Html Data Else Html End Html End If End For * Close the page. Close: Html
Online Status
OnlineSystem InitializationLogged on Users
ULSPFPRO
ULSPF{$substr(%port(%z),2)}Region or port not accessibleRemote port not responding as expectedInvalid response from online
{%doc:Value('//@inittime')} {%doc:Value('//stat')}

The code that generated this page can be seen here. This program that responds to the socket call is a small apsy subsystem that responds by sending an XML document. This code can be seen here.

End Html In file JANWEB include WEB/TEMPLATE_BOTTOM STOP INCREMENT: * ... End of mainline. ERRX: Call $Web_Flush Call $Web_Type('text/html') Text System error

System error

System terminated due to error.
Procedure causing error: STATUSMON.HTML Error message:
{%msg(1)} {%msg(2)} {%msg(3)} End Text Call $Web_Done STOP * Socket Error routine (socket errors jump to a label location). SOCKET_ERROR: %msg(1) = $Sock_Errinfo('CODE') %msg(2) = $Sock_Errinfo('SOCKNUM') %msg(3) = $Sock_Errinfo('FUN') Text System error

System error

System terminated due to error.
Procedure causing error: STATUSMON.HTML The connection was unexpectedly lost. The last socket error operation was:

Function: {%msg(3)}

Return code: {%msg(1)}

Socket: {%msg(2)}

End Text Call $Web_Done STOP End