| 1388 | **********************************************************************/ |
| 1389 | |
| 1390 | int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo, |
| 1391 | int numRequests, mapObj *map, layerObj *lp, imageObj *img) |
| 1392 | { |
| 1393 | #ifdef USE_WMS_LYR |
| 1394 | int status = MS_SUCCESS; |
| 1395 | int iReq = -1; |
| 1396 | char szPath[MS_MAXPATHLEN]; |
| 1397 | int currenttype; |
| 1398 | int currentconnectiontype; |
| 1399 | int numclasses; |
| 1400 | char *mem_filename = NULL; |
| 1401 | |
| 1402 | /* ------------------------------------------------------------------ |
| 1403 | * Find the request info for this layer in the array, based on nLayerId |
| 1404 | * ------------------------------------------------------------------ */ |
| 1405 | for(iReq=0; iReq<numRequests; iReq++) |
| 1406 | { |
| 1407 | if (pasReqInfo[iReq].nLayerId == nLayerId) |
| 1408 | break; |
| 1409 | } |
| 1410 | |
| 1411 | if (iReq == numRequests) |
| 1412 | { |
| 1413 | /* This layer was skipped or was included in a multi-layers |
| 1414 | * request ... nothing to do. |
| 1415 | */ |
| 1416 | return MS_SUCCESS; |
| 1417 | } |
| 1418 | |
| 1419 | if ( !MS_HTTP_SUCCESS( pasReqInfo[iReq].nStatus ) ) |
| 1420 | { |
| 1421 | /* ==================================================================== |
| 1422 | Failed downloading layer... we log an error but we still return |
| 1423 | SUCCESS here so that the layer is only skipped intead of aborting |
| 1424 | the whole draw map. |
| 1425 | ==================================================================== */ |
| 1426 | msSetError(MS_WMSERR, |
| 1427 | "WMS GetMap request failed for layer '%s' (Status %d: %s).", |
| 1428 | "msDrawWMSLayerLow()", |
| 1429 | (lp->name?lp->name:"(null)"), |
| 1430 | pasReqInfo[iReq].nStatus, pasReqInfo[iReq].pszErrBuf ); |
| 1431 | |
| 1432 | return MS_SUCCESS; |
| 1433 | } |
| 1434 | |
| 1435 | /* ------------------------------------------------------------------ |
| 1436 | * Check the content-type of the response to see if we got an exception, |
| 1437 | * if yes then try to parse it and pass the info to msSetError(). |
| 1438 | * We log an error but we still return SUCCESS here so that the layer |
| 1439 | * is only skipped intead of aborting the whole draw map. |
| 1440 | * ------------------------------------------------------------------ */ |
| 1441 | if (pasReqInfo[iReq].pszContentType && |
| 1442 | (strcmp(pasReqInfo[iReq].pszContentType, "text/xml") == 0 || |
| 1443 | strcmp(pasReqInfo[iReq].pszContentType, "application/vnd.ogc.se_xml") == 0)) |
| 1444 | { |
| 1445 | FILE *fp; |
| 1446 | char szBuf[MS_BUFFER_LENGTH]; |
| 1447 |
no test coverage detected