Qore SoapHandler Module Reference  0.3.2
SoapHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* SoapHandler.qm Copyright (C) 2012 - 2022 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 
114 namespace SoapHandler {
116 class SoapHandler : public AbstractHttpRequestHandler {
117 
118 public:
120  const Version = "0.2.6";
121 
123 protected:
124  // method mappings: method name -> method hash
125  hash<auto> methods;
126 
127  // reverse mappings for methods: unique_id -> method -> True
128  hash<string, hash<string, bool>> rmethods;
129 
130  // URI path -> method name -> method mappings
131  hash<string, hash> uri_methods;
132 
133  // reverse URI path method mappings: unique_id -> URI path -> method name -> true
134  hash<string, hash<string, hash<string, bool>>> ruri_methods;
135 
136  // service name -> WebService objects
137  hash<string, WebService> wsh;
138 
139  // reverse mapping to remove wsh mappings; unique_id -> path -> True
140  hash<string, hash<string, bool>> rwsh;
141 
142  // operation name -> WebService object
143  hash<string, WebService> owsh;
144 
145  // reverse operation mappings; unique_id -> op name -> true
146  hash<string, hash<string, bool>> rowsh;
147 
148  // lookup URI path -> WebService object
149  hash<string, WebService> wsph;
150 
151  // reverse URI path lookups: unique_id -> URI path -> true
152  hash<string, hash<string, bool>> rwsph;
153 
154  // URI path -> SOAP Action -> method mappings
155  hash<string, hash<string, hash>> uri_sam;
156 
157  // reverse URI path -> SOAP Action mappings: unique_id -> URI path -> SOAPAction -> true
158  hash<string, hash<string, hash<string, bool>>> ruri_sam;
159 
160  // soapaction map: action -> binding -> operation
161  hash<string, hash> sam;
162 
163  // reverse mapping: unique_id -> soapaction -> True
164  hash<string, hash<string, bool>> rsam;
165 
166  int loglevel;
167 
168  // if True then verbose exception info will be logged
169  bool debug;
170 
171  // a closure/call reference to get the log message and/or process arguments in incoming requests
172  *code getLogMessage;
173 
174  // for atomicity when adding / removing methods
175  RWLock rwl();
176 
177  // path TreeMap for each HTTP method
178  hash<string, TreeMap> mapMethodPathToOperation;
179 
180  // soapaction -> method -> binding
181 
182 public:
184 
186 
195  constructor(AbstractAuthenticator auth, *code n_getLogMessage, bool dbg = False)
196  ;
197 
198 
200 
217 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);
218 
219 
221  setDebug(bool dbg = True);
222 
223 
225  bool getDebug();
226 
227 
229 
231  removeService(string unique_id);
232 
233 
235  // don't reimplement this method; fix/enhance it in the module
236 protected:
237  final addMethodInternal(WebService ws, hash<auto> method);
238 public:
239 
240 
241 protected:
242  *hash<auto> help(hash<auto> cx);
243 public:
244 
245 
246  // don't reimplement this method; fix/enhance it in the module
247 protected:
248  final log(hash<auto> cx, string str);
249 public:
250 
251 
268 protected:
269  nothing msglog(hash<auto> cx, hash<auto> msg);
270 public:
271 
272 
273  // don't reimplement this method; fix/enhance it in the module
274 protected:
275  hash<auto> makeSoapFaultResponse(hash<auto> cx, string errLog, bool soap12, string err, string desc, *bool fmt);
276 public:
277 
278 
279  // don't reimplement this method; fix/enhance it in the module
280 protected:
281  final *hash<auto> callOperation(hash<auto> cx, auto args, hash<auto> method, bool reqsoap12);
282 public:
283 
284 
286 protected:
287  auto dispatchSoapOperationCall(hash<auto> method, hash<auto> cx, auto args);
288 public:
289 
290 
291 protected:
292  *hash<auto> matchMethod(TreeMap tm, string path, reference unmatched);
293 public:
294 
295 
296  // method called by HttpServer
297  // don't reimplement this method; fix/enhance it in the module
298  final hash<auto> handleRequest(hash<auto> cx, hash<auto> hdr, *data body);
299 
300 
301 protected:
302  *WebService tryMatch(string path);
303 public:
304 
306  };
307 };
removeService(string unique_id)
call to remove the given service
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
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
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:114