Qore SoapHandler Module Reference  0.2.6
SoapHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* SoapHandler.qm Copyright (C) 2012 - 2018 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 
92 namespace SoapHandler {
95 class SoapHandler : public AbstractHttpRequestHandler {
96 
97 public:
99  const Version = "0.2.6";
100 
102  private :
103  // method mappings: method name -> method hash
104  hash<auto> methods;
105 
106  // reverse mappings for methods: unique_id -> method -> True
107  hash<string, hash<string, bool>> rmethods;
108 
109  // URI path -> method name -> method mappings
110  hash<string, hash> uri_methods;
111 
112  // reverse URI path method mappings: unique_id -> URI path -> method name -> true
113  hash<string, hash<string, hash<string, bool>>> ruri_methods;
114 
115  // service name -> WebService objects
116  hash<string, WebService> wsh;
117 
118  // reverse mapping to remove wsh mappings; unique_id -> path -> True
119  hash<string, hash<string, bool>> rwsh;
120 
121  // operation name -> WebService object
122  hash<string, WebService> owsh;
123 
124  // reverse operation mappings; unique_id -> op name -> true
125  hash<string, hash<string, bool>> rowsh;
126 
127  // lookup URI path -> WebService object
128  hash<string, WebService> wsph;
129 
130  // reverse URI path lookups: unique_id -> URI path -> true
131  hash<string, hash<string, bool>> rwsph;
132 
133  // URI path -> SOAP Action -> method mappings
134  hash<string, hash<string, hash>> uri_sam;
135 
136  // reverse URI path -> SOAP Action mappings: unique_id -> URI path -> SOAPAction -> true
137  hash<string, hash<string, hash<string, bool>>> ruri_sam;
138 
139  // soapaction map: action -> binding -> operation
140  hash<string, hash> sam;
141 
142  // reverse mapping: unique_id -> soapaction -> True
143  hash<string, hash<string, bool>> rsam;
144 
145  int loglevel;
146 
147  // if True then verbose exception info will be logged
148  bool debug;
149 
150  // a closure/call reference to get the log message and/or process arguments in incoming requests
151  *code getLogMessage;
152 
153  // for atomicity when adding / removing methods
154  RWLock rwl();
155 
156  // path TreeMap for each HTTP method
157  hash<string, TreeMap> mapMethodPathToOperation;
158 
159  // soapaction -> method -> binding
160 
161 public:
163 
165 
169  constructor(AbstractAuthenticator auth, *code n_getLogMessage, bool dbg = False) ;
170 
171 
173 
185  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);
186 
187 
189  setDebug(bool dbg = True);
190 
191 
193  bool getDebug();
194 
195 
197 
199  removeService(string unique_id);
200 
201 
203  // don't reimplement this method; fix/enhance it in the module
204 
205 private:
206  final addMethodInternal(WebService ws, hash<auto> method);
207 public:
208 
209 
210 
211 private:
212  *hash<auto> help(hash<auto> cx);
213 public:
214 
215 
216  // don't reimplement this method; fix/enhance it in the module
217 
218 private:
219  final log(hash<auto> cx, string str);
220 public:
221 
222 
240 private:
241  nothing msglog(hash<auto> cx, hash<auto> msg);
242 public:
243 
244 
245  // don't reimplement this method; fix/enhance it in the module
246 
247 private:
248  hash<auto> makeSoapFaultResponse(hash<auto> cx, string errLog, bool soap12, string err, string desc, *bool fmt);
249 public:
250 
251 
252  // don't reimplement this method; fix/enhance it in the module
253 
254 private:
255  final *hash<auto> callOperation(hash<auto> cx, auto args, hash<auto> method, bool reqsoap12);
256 public:
257 
258 
259 
260 private:
261  *hash<auto> matchMethod(TreeMap tm, string path, reference unmatched);
262 public:
263 
264 
265  // method called by HttpServer
266  // don't reimplement this method; fix/enhance it in the module
267  final hash<auto> handleRequest(hash<auto> cx, hash<auto> hdr, *data body);
268 
269 
270 
271 private:
272  *WebService tryMatch(string path);
273 public:
274 
276  };
277 };
main SoapHandler namespace
Definition: SoapHandler.qm.dox.h:93