+ struct afb_svc *svc = closure;
+ struct svc_req *svcreq;
+ struct json_object *ierr;
+
+ HOOK(call, svc, api, verb, args);
+
+ /* allocates the request */
+ svcreq = svcreq_create(svc, api, verb, args);
+ if (svcreq == NULL) {
+ ERROR("out of memory");
+ json_object_put(args);
+ ierr = afb_msg_json_internal_error();
+ callback(cbclosure, -1, ierr);
+ HOOK(call_result, svc, -1, ierr);
+ json_object_put(ierr);
+ return;
+ }
+
+ /* initialises the request */
+ svcreq->jobloop = NULL;
+ svcreq->callback = callback;
+ svcreq->closure = cbclosure;
+
+ /* terminates and frees ressources if needed */
+ afb_xreq_process(&svcreq->xreq, svc->apiset);