/** * Server Status SOAP service handler for GetServerStatus. * * @param req SOAP request context * @param res SOAP response context * * @return H_OK on success */ static herror_t _get_server_status(SoapCtx *req, SoapCtx *res) { xmlNode *cmd; cmd = soap_env_get_method(req->env); soap_env_new_with_method(cmd->ns->href, "GetServerStatusResponse", &res->env); /* TODO */ xmlNode *result = xmlNewChild(res->env->body->children->next, NULL, "GetServerStatusResult", NULL); return H_OK; }
herror_t soap_ctx_new_with_method(const char *urn, const char *method, SoapCtx ** out) { SoapEnv *env; herror_t err; err = soap_env_new_with_method(urn, method, &env); if (err != H_OK) return err; *out = soap_ctx_new(env); return H_OK; }
/** * Server Status SOAP service handler for CheckAuthentication. * * @param req SOAP request context * @param res SOAP response context * * @return H_OK on success */ static herror_t _check_authentication(SoapCtx *req, SoapCtx *res) { xmlNode *cmd; cmd = soap_env_get_method(req->env); soap_env_new_with_method(cmd->ns->href, "CheckAuthenticationResponse", &res->env); /* TODO */ xmlNode *result = xmlNewChild(res->env->body->children->next, NULL, "CheckAuthenticationResult", "REDMOND\\bob"); return H_OK; }
herror_t soap_env_new_with_response(SoapEnv * request, SoapEnv ** out) { char *method, *res_method; herror_t ret; char *urn; if (request == NULL) { return herror_new("soap_env_new_with_response", GENERAL_INVALID_PARAM, "request (first param) is NULL"); } if (request->root == NULL) { return herror_new("soap_env_new_with_response", GENERAL_INVALID_PARAM, "request (first param) has no xml structure"); } if (!(method = soap_env_find_methodname(request))) { return herror_new("soap_env_new_with_response", GENERAL_INVALID_PARAM, "Method name '%s' not found in request", SAVE_STR(method)); } if (!(urn = soap_env_find_urn(request))) { /* here we have no chance to find out the namespace */ /* try to continue without namespace (urn) */ urn = ""; } if (!(res_method = (char *)malloc(strlen(method)+9))) return herror_new("soap_env_new_with_response", GENERAL_INVALID_PARAM, "malloc failed"); sprintf(res_method, "%sResponse", method); ret = soap_env_new_with_method(urn, res_method, out); free(res_method); return ret; }