Qore SoapHandler Module Reference  0.2.7
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 
99 namespace SoapHandler {
102 class SoapHandler : public AbstractHttpRequestHandler {
103 
104 public:
106  const Version = "0.2.6";
107 
109 protected:
110  // method mappings: method name -> method hash
111  hash<auto> methods;
112 
113  // reverse mappings for methods: unique_id -> method -> True
114  hash<string, hash<string, bool>> rmethods;
115 
116  // URI path -> method name -> method mappings
117  hash<string, hash> uri_methods;
118 
119  // reverse URI path method mappings: unique_id -> URI path -> method name -> true
120  hash<string, hash<string, hash<string, bool>>> ruri_methods;
121 
122  // service name -> WebService objects
123  hash<string, WebService> wsh;
124 
125  // reverse mapping to remove wsh mappings; unique_id -> path -> True
126  hash<string, hash<string, bool>> rwsh;
127 
128  // operation name -> WebService object
129  hash<string, WebService> owsh;
130 
131  // reverse operation mappings; unique_id -> op name -> true
132  hash<string, hash<string, bool>> rowsh;
133 
134  // lookup URI path -> WebService object
135  hash<string, WebService> wsph;
136 
137  // reverse URI path lookups: unique_id -> URI path -> true
138  hash<string, hash<string, bool>> rwsph;
139 
140  // URI path -> SOAP Action -> method mappings
141  hash<string, hash<string, hash>> uri_sam;
142 
143  // reverse URI path -> SOAP Action mappings: unique_id -> URI path -> SOAPAction -> true
144  hash<string, hash<string, hash<string, bool>>> ruri_sam;
145 
146  // soapaction map: action -> binding -> operation
147  hash<string, hash> sam;
148 
149  // reverse mapping: unique_id -> soapaction -> True
150  hash<string, hash<string, bool>> rsam;
151 
152  int loglevel;
153 
154  // if True then verbose exception info will be logged
155  bool debug;
156 
157  // a closure/call reference to get the log message and/or process arguments in incoming requests
158  *code getLogMessage;
159 
160  // for atomicity when adding / removing methods
161  RWLock rwl();
162 
163  // path TreeMap for each HTTP method
164  hash<string, TreeMap> mapMethodPathToOperation;
165 
166  // soapaction -> method -> binding
167 
168 public:
170 
172 
176  constructor(AbstractAuthenticator auth, *code n_getLogMessage, bool dbg = False) ;
177 
178 
180 
192  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);
193 
194 
196  setDebug(bool dbg = True);
197 
198 
200  bool getDebug();
201 
202 
204 
206  removeService(string unique_id);
207 
208 
210  // don't reimplement this method; fix/enhance it in the module
211 protected:
212  final addMethodInternal(WebService ws, hash<auto> method);
213 public:
214 
215 
216 protected:
217  *hash<auto> help(hash<auto> cx);
218 public:
219 
220 
221  // don't reimplement this method; fix/enhance it in the module
222 protected:
223  final log(hash<auto> cx, string str);
224 public:
225 
226 
243 protected:
244  nothing msglog(hash<auto> cx, hash<auto> msg);
245 public:
246 
247 
248  // don't reimplement this method; fix/enhance it in the module
249 protected:
250  hash<auto> makeSoapFaultResponse(hash<auto> cx, string errLog, bool soap12, string err, string desc, *bool fmt);
251 public:
252 
253 
254  // don't reimplement this method; fix/enhance it in the module
255 protected:
256  final *hash<auto> callOperation(hash<auto> cx, auto args, hash<auto> method, bool reqsoap12);
257 public:
258 
259 
260 protected:
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 protected:
271  *WebService tryMatch(string path);
272 public:
273 
275  };
276 };
SoapHandler
main SoapHandler namespace
Definition: SoapHandler.qm.dox.h:100