Diff
Not logged in

Differences From Artifact [357659fc60]:

To Artifact [ea50e12e79]:


1
2
3
4
5
6
7
8
9
10
<HTML lang=en dir=ltr xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Creating a Tcl Web Service - Visiwiki</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="Creating a Tcl Web Service" name=KEYWORDS>
</HEAD>
<BODY>
<H1>Creating a Tcl Web Service</H1>

<TABLE class=toc id=toc>


|







1
2
3
4
5
6
7
8
9
10
<HTML lang=en dir=ltr xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>Creating a Tcl Web Service</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="Creating a Tcl Web Service" name=KEYWORDS>
</HEAD>
<BODY>
<H1>Creating a Tcl Web Service</H1>

<TABLE class=toc id=toc>
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
        <LI class=toclevel-1><A href="#Declaring_Complex_Types"><SPAN
        class=tocnumber>4</SPAN> <SPAN class=toctext>Declaring Complex
        Types</SPAN></A> </LI></UL></TD></TR></TBODY></TABLE>

<A name=Loading_the_Webservices_Server_Package></A>
<H2>Loading the Webservices Server Package </H2>

<P>
The Web Services package, WS::Server, is not a standalone application, but rather is designed
be a "module" of TclHttpd.
The following command is normally placed in httpdthread.tcl:
</P>

<P>To load the webservices server package, do: </P><PRE> package require WS::Server
</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=Defining_a_Service></A>
<H2>Defining a Service </H2>

<P>
The code that defines a service is normally placed in one or more files in the custom directory.
</P>

<P><B>Procedure Name&nbsp;: <I>::WS::Server::</I>Service</B> </P>
<P><B>Description</B>&nbsp;: Declare a Web Service, the following URLs will
exist </P><PRE>               /service/&lt;ServiceName&gt;
                     Displays an HTML page describing the service
               /service/&lt;ServiceName&gt;/wsdl
                     Returns a WSDL describing the service
               /service/&lt;ServiceName&gt;/op
                     Invoke an operation







<
<
<
<
<
<






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










|







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
        <LI class=toclevel-1><A href="#Declaring_Complex_Types"><SPAN
        class=tocnumber>4</SPAN> <SPAN class=toctext>Declaring Complex
        Types</SPAN></A> </LI></UL></TD></TR></TBODY></TABLE>

<A name=Loading_the_Webservices_Server_Package></A>
<H2>Loading the Webservices Server Package </H2>







<P>To load the webservices server package, do: </P><PRE> package require WS::Server
</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>

<h3>Using as part of TclHttpd</h3>

<P>
The Web Services package, WS::Server, is not a standalone application, but rather is designed
be a "module" of TclHttpd.
The following command is normally placed in httpdthread.tcl:
</P>


<h3>Embedding in a Standalone Application</h3>

<P>
To embed a Web Service into an application, the application needs to be event
driven and you also need to use the <B>WS::Embeded</b> package.  You also must
define the service with the <i>-mode=embedded</i> option.
</P>

<P>
See also
<A HREF="Embedded Web Service.html">Embeding a Web Service into an application</A>.
</P>

<HR>

<A name=Defining_a_Service></A>
<H2>Defining a Service </H2>

<P>
The code that defines a service is normally placed in one or more files in the custom directory.
</P>

<P><B>Procedure Name&nbsp;: <I>::WS::Server::Service</I></B> </P>
<P><B>Description</B>&nbsp;: Declare a Web Service, the following URLs will
exist </P><PRE>               /service/&lt;ServiceName&gt;
                     Displays an HTML page describing the service
               /service/&lt;ServiceName&gt;/wsdl
                     Returns a WSDL describing the service
               /service/&lt;ServiceName&gt;/op
                     Invoke an operation
84
85
86
87
88
89
90










91
92
93
94
95
96
97
                                   The signature of the command must be:
                                     cmd \
                                         service \
                                         operation \
                                         caller_ipaddr \
                                         http_header_list \
                                         soap_header_list










</PRE>
<P><B>Returns</B>&nbsp;: Nothing </P>
<P><B>Side-Effects</B>&nbsp;: None </P>
<P><B>Exception Conditions</B>&nbsp;: </P><PRE>     <I>MISSREQARG</I> -- Missing required arguements
</PRE>
<P><B>Pre-requisite Conditions</B>&nbsp;: None </P>
<HR>







>
>
>
>
>
>
>
>
>
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
                                   The signature of the command must be:
                                     cmd \
                                         service \
                                         operation \
                                         caller_ipaddr \
                                         http_header_list \
                                         soap_header_list
            -mode           - Mode that service is running in.  Must be one of:
                                   tclhhtpd -- running inside of tclhttpd or an
                                               evironment that supplies a
                                               compatilbe Url_PrefixInstall
                                               and Httpd_ReturnData commands
                                   embedded -- using the ::WS::Embedded package
            -ports          - List of ports for embedded mode. Default: 80
                                    NOTE -- a call should be to
                                            ::WS::Embedded::Listen for each port
                                            in this list prior to this call
</PRE>
<P><B>Returns</B>&nbsp;: Nothing </P>
<P><B>Side-Effects</B>&nbsp;: None </P>
<P><B>Exception Conditions</B>&nbsp;: </P><PRE>     <I>MISSREQARG</I> -- Missing required arguements
</PRE>
<P><B>Pre-requisite Conditions</B>&nbsp;: None </P>
<HR>