diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2005-08-25 15:29:33 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2005-08-25 15:29:33 +0000 |
| commit | 26c600fc4e4e04b7aa3d888043e1783cc8c85ca5 (patch) | |
| tree | fd721aca964786f8324cc4767588db4384bb0cc0 | |
| parent | 987fb151d18609d82b0f1247be60629e054cc8b9 (diff) | |
| download | lasso-26c600fc4e4e04b7aa3d888043e1783cc8c85ca5.tar.gz lasso-26c600fc4e4e04b7aa3d888043e1783cc8c85ca5.tar.xz lasso-26c600fc4e4e04b7aa3d888043e1783cc8c85ca5.zip | |
complete last commit.
| -rw-r--r-- | lasso/id-wsf/data_service.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lasso/id-wsf/data_service.c b/lasso/id-wsf/data_service.c index 378288ac..cf22084e 100644 --- a/lasso/id-wsf/data_service.c +++ b/lasso/id-wsf/data_service.c @@ -204,6 +204,52 @@ lasso_data_service_process_query_msg(LassoDataService *service, const char *mess return 0; } +gint +lasso_data_service_build_modify_response_msg(LassoDataService *service) { + LassoWsfProfile *profile; + LassoDstModify *request; + LassoDstModifyResponse *response; + + GList *iter; + xmlDoc *doc; + xmlXPathContext *xpathCtx; + xmlXPathObject *xpathObj; + + LassoSoapEnvelope *envelope; + + profile = LASSO_WSF_PROFILE(service); + request = LASSO_DST_MODIFY(profile->request); + + response = lasso_dst_modify_response_new( + lasso_utility_status_new(LASSO_DST_STATUS_CODE_OK)); + profile->response = LASSO_NODE(response); + response->prefixServiceType = g_strdup(request->prefixServiceType); + response->hrefServiceType = g_strdup(request->hrefServiceType); + envelope = profile->soap_envelope_response; + envelope->Body->any = g_list_append(envelope->Body->any, response); + + doc = xmlNewDoc((xmlChar*)"1.0"); + xmlDocSetRootElement(doc, service->resource_data); + xpathCtx = xmlXPathNewContext(doc); + xmlXPathRegisterNs(xpathCtx, (xmlChar*)response->prefixServiceType, + (xmlChar*)response->hrefServiceType); + + iter = request->Modification; + while (iter) { + LassoDstModification *modification = iter->data; + xmlNode *newNode = modification->NewData->any->data; + xpathObj = xmlXPathEvalExpression((xmlChar*)modification->Select, xpathCtx); + if (xpathObj && xpathObj->nodesetval && xpathObj->nodesetval->nodeNr) { + xmlNode *node = xpathObj->nodesetval->nodeTab[0]; + xmlReplaceNode(node, newNode); + } + + iter = g_list_next(iter); + } + + return lasso_wsf_profile_build_soap_response_msg(profile); +} + /** * lasso_data_service_build_response_msg: * @service: a #LassoDataService |
