/ msWCSGetCapabilities11() */ /
| 365 | /* msWCSGetCapabilities11() */ |
| 366 | /************************************************************************/ |
| 367 | int msWCSGetCapabilities11(mapObj *map, wcsParamsObj *params, |
| 368 | cgiRequestObj *req, owsRequestObj *ows_request) |
| 369 | { |
| 370 | xmlDocPtr psDoc = NULL; /* document pointer */ |
| 371 | xmlNodePtr psRootNode, psMainNode, psNode; |
| 372 | xmlNodePtr psTmpNode; |
| 373 | char *identifier_list = NULL, *format_list = NULL; |
| 374 | const char *updatesequence=NULL; |
| 375 | const char *encoding; |
| 376 | xmlNsPtr psOwsNs, psXLinkNs; |
| 377 | char *schemaLocation = NULL; |
| 378 | char *xsi_schemaLocation = NULL; |
| 379 | char *script_url=NULL, *script_url_encoded=NULL; |
| 380 | |
| 381 | xmlChar *buffer = NULL; |
| 382 | int size = 0, i; |
| 383 | msIOContext *context = NULL; |
| 384 | |
| 385 | int ows_version = OWS_1_1_0; |
| 386 | |
| 387 | /* -------------------------------------------------------------------- */ |
| 388 | /* Handle updatesequence */ |
| 389 | /* -------------------------------------------------------------------- */ |
| 390 | |
| 391 | updatesequence = msOWSLookupMetadata(&(map->web.metadata), "CO", "updatesequence"); |
| 392 | encoding = msOWSLookupMetadata(&(map->web.metadata), "CO", "encoding"); |
| 393 | |
| 394 | if (params->updatesequence != NULL) { |
| 395 | i = msOWSNegotiateUpdateSequence(params->updatesequence, updatesequence); |
| 396 | if (i == 0) { /* current */ |
| 397 | msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is equal to server (%s)", "msWCSGetCapabilities11()", params->updatesequence, updatesequence); |
| 398 | return msWCSException11(map, "updatesequence", "CurrentUpdateSequence", params->version); |
| 399 | } |
| 400 | if (i > 0) { /* invalid */ |
| 401 | msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is higher than server (%s)", "msWCSGetCapabilities11()", params->updatesequence, updatesequence); |
| 402 | return msWCSException11(map, "updatesequence", "InvalidUpdateSequence", params->version); |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | /* -------------------------------------------------------------------- */ |
| 407 | /* Build list of layer identifiers available. */ |
| 408 | /* -------------------------------------------------------------------- */ |
| 409 | identifier_list = msStrdup(""); |
| 410 | for(i=0; i<map->numlayers; i++) |
| 411 | { |
| 412 | layerObj *layer = map->layers[i]; |
| 413 | int new_length; |
| 414 | |
| 415 | if(!msWCSIsLayerSupported(layer)) |
| 416 | continue; |
| 417 | |
| 418 | new_length = strlen(identifier_list) + strlen(layer->name) + 2; |
| 419 | identifier_list = (char *) realloc(identifier_list,new_length); |
| 420 | |
| 421 | if( strlen(identifier_list) > 0 ) |
| 422 | strcat( identifier_list, "," ); |
| 423 | strcat( identifier_list, layer->name ); |
| 424 | } |
no test coverage detected