1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
<HTML lang=en dir=ltr xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Embeding a Web Service</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="Embeding a Web Service" name=KEYWORDS>
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
</HEAD>
<BODY>
<H1>Embeding a Web Service</H1>
<TABLE class=toc id=toc>
<TR>
<TD>
<DIV id=toctitle>
<H2>Contents</H2></DIV>
<UL>
<LI class=toclevel-1><A href="#Loading_the_Webservices_Embeded_Package"><SPAN
class=tocnumber>1</SPAN> <SPAN class=toctext>Loading the Webservices
Embeded Package</SPAN></A>
<LI class=toclevel-1><A href="#Listen"><SPAN
class=tocnumber>2</SPAN> <SPAN class=toctext>Specify a Port to Receive Request on</SPAN></A>
<LI class=toclevel-1><A href="#EventQueue"><SPAN
class=tocnumber>3</SPAN> <SPAN class=toctext>Run the event queue</SPAN></A>
<LI class=toclevel-1><A href="#Close"><SPAN
class=tocnumber>4</SPAN> <SPAN class=toctext>Close a port</SPAN></A>
<LI class=toclevel-1><A href="#CloseAll"><SPAN
class=tocnumber>4</SPAN> <SPAN class=toctext>Close all ports</SPAN></A>
</UL>
</TD>
</TR>
</TABLE>
<A name=Loading_the_Webservices_Embeded_Package></A>
<H2>Loading the Webservices Server Package </H2>
<P>To load the webservices server package, do: </P><PRE> package require WS::Embeded
</PRE>
<P>This command will only load the server the first time it is used, so it
causes no ill effects to put this in each file declaring a service or service
procedure. </P>
<HR />
<A name=Listen></A>
<H2>Specify a Port to Receive Request on</H2>
<P>The following command opens a listener socket in the specified port.
The webservice functionality may be added by a call to <I>::WS::Server::Service</I> with the <I>-mode</I> parameter set to <I>embedded</I>.
<P><B>Procedure Name : <I>::WS::Embeded::Listen</I></B> </P>
<P><B>Description</B> : Instruct the module to listen on a Port, security information.
<P><B>Arguments</B> : this procedure uses position dependent arguments,
they are: </P>
<PRE>
<I>port </I> -- Port number to listen on.
<I>certfile</I> -- Name of the certificate file or a pfx archive for twapi.
Defaults to {}.
<I>keyfile </I> -- Name of the key file. Defaults to {}.
To use twapi TLS, specify a list with the following elements:
-- "-twapi": Flag, that TWAPI TLS should be used
-- password: password of PFX file passed by
[::twapi::conceal]. The concealing makes sure that the
password is not readable in the error stack trace
-- ?subject?: optional search string in pfx file, if
multiple certificates are included.
<I>userpwds</I> -- A list of username:password. Defaults to {}.
<I>realm </I> -- The seucrity realm. Defaults to {}.
<I>timeout </I> -- A time in ms the sender may use to send the request.
If a sender sends wrong data (Example: TLS if no TLS is
used), the process will just stand and a timeout is required
to clear the connection. Set to 0 to not use a timeout.
Default: 60000 (1 Minuit).
</PRE>
<P><B>Returns</B> : Handle of socket </P>
<P><B>Side-Effects</B> : None </P>
<P><B>Exception Conditions</B> : : None </P>
<P><B>Pre-requisite Conditions</B> : None </P>
<HR />
<A name=EventQueue></A>
<H2>Run the event queue</H2>
<P>To serve any requests, the interpreter must run the event queue using.
If this is not anyway the case (Tk present etc.), one may call:</P>
<PRE>
vwait waitVariable
</PRE>
<P>To stop the event queue after server shutdown, one may execute:</P>
<PRE>
set waitVariable 1
</PRE>
<HR />
<A name=Close></A>
<H2>Close a port</H2>
<P><B>Procedure Name : <I>::WS::Embeded::Close</I></B> </P>
<P><B>Description</B> : Close a formerly opened listener port and stop all running requests on this port.
<P><B>Arguments</B> : this procedure uses position dependent arguments,
they are: </P>
<PRE>
<I>port </I> -- Port number to close.
</PRE>
<P><B>Returns</B> : None </P>
<P><B>Side-Effects</B> : None </P>
<P><B>Exception Conditions</B> : : None </P>
<P><B>Pre-requisite Conditions</B> : None </P>
<HR />
<A name=CloseAll></A>
<H2>Close all ports</H2>
<P><B>Procedure Name : <I>::WS::Embeded::CloseAll</I></B> </P>
<P><B>Description</B> : Close all formerly opened listener port and stop all running requests.
<P><B>Arguments</B> : this procedure uses no arguments</P>
<P><B>Returns</B> : None </P>
<P><B>Side-Effects</B> : None </P>
<P><B>Exception Conditions</B> : : None </P>
<P><B>Pre-requisite Conditions</B> : None </P>
</BODY>
</HTML>
|