Qore SoapHandler Module Reference  0.3.1
SoapHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* SoapHandler.qm Copyright (C) 2012 - 2021 Qore Technologies, s.r.o.
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 // make sure we have the required qore version
26 
27 // requires XML functionality
28 
29 // requires the WSDL module
30 
31 // need mime definitions
32 
33 // need definitions from the HttpServerUtil
34 
35 // need Util functions
36 
37 // do not use $ for vars
38 
39 // require type declarations everywhere
40 
41 // do not ignore errors in call arguments
42 
43 
108 namespace SoapHandler {
110 class SoapHandler : public AbstractHttpRequestHandler {
111 
112 public:
114  const Version = "0.2.6";
115 
117 protected:
118  // method mappings: method name -> method hash
119  hash<auto> methods;
120 
121  // reverse mappings for methods: unique_id -> method -> True
122  hash<string, hash<string, bool>> rmethods;
123 
124  // URI path -> method name -> method mappings
125  hash<string, hash> uri_methods;
126 
127  // reverse URI path method mappings: unique_id -> URI path -> method name -> true
128  hash<string, hash<string, hash<string, bool>>> ruri_methods;
129 
130  // service name -> WebService objects
131  hash<string, WebService> wsh;
132 
133  // reverse mapping to remove wsh mappings; unique_id -> path -> True
134  hash<string, hash<string, bool>> rwsh;
135 
136  // operation name -> WebService object
137  hash<string, WebService> owsh;
138 
139  // reverse operation mappings; unique_id -> op name -> true
140  hash<string, hash<string, bool>> rowsh;
141 
142  // lookup URI path -> WebService object
143  hash<string, WebService> wsph;
144 
145  // reverse URI path lookups: unique_id -> URI path -> true
146  hash<string, hash<string, bool>> rwsph;
147 
148  // URI path -> SOAP Action -> method mappings
149  hash<string, hash<string, hash>> uri_sam;
150 
151  // reverse URI path -> SOAP Action mappings: unique_id -> URI path -> SOAPAction -> true
152  hash<string, hash<string, hash<string, bool>>> ruri_sam;
153 
154  // soapaction map: action -> binding -> operation
155  hash<string, hash> sam;
156 
157  // reverse mapping: unique_id -> soapaction -> True
158  hash<string, hash<string, bool>> rsam;
159 
160  int loglevel;
161 
162  // if True then verbose exception info will be logged
163  bool debug;
164 
165  // a closure/call reference to get the log message and/or process arguments in incoming requests
166  *code getLogMessage;
167 
168  // for atomicity when adding / removing methods
169  RWLock rwl();
170 
171  // path TreeMap for each HTTP method
172  hash<string, TreeMap> mapMethodPathToOperation;
173 
174  // soapaction -> method -> binding
175 
176 public:
178 
180 
184  constructor(AbstractAuthenticator auth, *code n_getLogMessage, bool dbg = False) ;
185 
186 
188 
200  addMethod(WebService ws, WSOperation op, auto func, *string help, *int logopt, auto cmark, *string path, auto err_func, *string altpath, *string binding, *string unique_id);
201 
202 
204  setDebug(bool dbg = True);
205 
206 
208  bool getDebug();
209 
210 
212 
214  removeService(string unique_id);
215 
216 
218  // don't reimplement this method; fix/enhance it in the module
219 protected:
220  final addMethodInternal(WebService ws, hash<auto> method);
221 public:
222 
223 
224 protected:
225  *hash<auto> help(hash<auto> cx);
226 public:
227 
228 
229  // don't reimplement this method; fix/enhance it in the module
230 protected:
231  final log(hash<auto> cx, string str);
232 public:
233 
234 
251 protected:
252  nothing msglog(hash<auto> cx, hash<auto> msg);
253 public:
254 
255 
256  // don't reimplement this method; fix/enhance it in the module
257 protected:
258  hash<auto> makeSoapFaultResponse(hash<auto> cx, string errLog, bool soap12, string err, string desc, *bool fmt);
259 public:
260 
261 
262  // don't reimplement this method; fix/enhance it in the module
263 protected:
264  final *hash<auto> callOperation(hash<auto> cx, auto args, hash<auto> method, bool reqsoap12);
265 public:
266 
267 
268 protected:
269  *hash<auto> matchMethod(TreeMap tm, string path, reference unmatched);
270 public:
271 
272 
273  // method called by HttpServer
274  // don't reimplement this method; fix/enhance it in the module
275  final hash<auto> handleRequest(hash<auto> cx, hash<auto> hdr, *data body);
276 
277 
278 protected:
279  *WebService tryMatch(string path);
280 public:
281 
283  };
284 };
removeService(string unique_id)
call to remove the given service
addMethod(WebService ws, WSOperation op, auto func, *string help, *int logopt, auto cmark, *string path, auto err_func, *string altpath, *string binding, *string unique_id)
adds a method to the handler dynamically
bool getDebug()
returns the current status of the debug flag
constructor(AbstractAuthenticator auth, *code n_getLogMessage, bool dbg=False)
creates the handler with the given method list
setDebug(bool dbg=True)
turns on or off debugging; when debugging is enabled more verbose error messages are reported
main SoapHandler namespace
Definition: SoapHandler.qm.dox.h:108