** msWFSDispatch() is the entry point for WFS requests. ** - If this is a valid request then it is processed and MS_SUCCESS is returned ** on success, or MS_FAILURE on failure. ** - If this does not appear to be a valid WFS request then MS_DONE ** is returned and MapServer is expected to process this as a regular ** MapServer request. */
| 2683 | ** MapServer request. |
| 2684 | */ |
| 2685 | int msWFSDispatch(mapObj *map, cgiRequestObj *requestobj, owsRequestObj *ows_request, int force_wfs_mode) |
| 2686 | { |
| 2687 | #ifdef USE_WFS_SVR |
| 2688 | int status; |
| 2689 | int returnvalue = MS_DONE; |
| 2690 | |
| 2691 | /* static char *wmtver = NULL, *request=NULL, *service=NULL; */ |
| 2692 | wfsParamsObj *paramsObj; |
| 2693 | /* |
| 2694 | ** Populate the Params object based on the request |
| 2695 | */ |
| 2696 | paramsObj = msWFSCreateParamsObj(); |
| 2697 | /* TODO : store also parameters that are inside the map object */ |
| 2698 | /* into the paramsObj. */ |
| 2699 | if (msWFSParseRequest(map, requestobj, ows_request, paramsObj, force_wfs_mode) == MS_FAILURE) |
| 2700 | return msWFSException(map, "request", "InvalidRequest", NULL); |
| 2701 | |
| 2702 | if (force_wfs_mode) |
| 2703 | { |
| 2704 | /*request is always required*/ |
| 2705 | if (paramsObj->pszRequest==NULL || strlen(paramsObj->pszRequest)<=0) |
| 2706 | { |
| 2707 | msSetError(MS_WFSERR, |
| 2708 | "Incomplete WFS request: REQUEST parameter missing", |
| 2709 | "msWFSDispatch()"); |
| 2710 | returnvalue = msWFSException(map, "request", "MissingParameterValue", paramsObj->pszVersion); |
| 2711 | msWFSFreeParamsObj(paramsObj); |
| 2712 | free(paramsObj); |
| 2713 | paramsObj = NULL; |
| 2714 | return returnvalue; |
| 2715 | } |
| 2716 | |
| 2717 | /*version: |
| 2718 | wfs 1.0 and 1.1.0 POST request: optional |
| 2719 | wfs 1.0 and 1.1.0 GET request: optional for getcapabilities and required for describefeatute and getfeature |
| 2720 | */ |
| 2721 | if (paramsObj->pszVersion == NULL && requestobj && requestobj->postrequest == MS_FALSE && |
| 2722 | strcasecmp(paramsObj->pszRequest, "GetCapabilities") != 0) |
| 2723 | { |
| 2724 | msSetError(MS_WFSERR, |
| 2725 | "Invalid WFS request: VERSION parameter missing", |
| 2726 | "msWFSDispatch()"); |
| 2727 | returnvalue = msWFSException(map, "version", "MissingParameterValue", paramsObj->pszVersion); |
| 2728 | msWFSFreeParamsObj(paramsObj); |
| 2729 | free(paramsObj); |
| 2730 | paramsObj = NULL; |
| 2731 | return returnvalue; |
| 2732 | } |
| 2733 | |
| 2734 | if (paramsObj->pszVersion == NULL || strlen(paramsObj->pszVersion) <=0) |
| 2735 | paramsObj->pszVersion = msStrdup("1.1.0"); |
| 2736 | |
| 2737 | /*service |
| 2738 | wfs 1.0 and 1.1.0 GET: required and should be set to WFS |
| 2739 | wfs 1.0 POST: required |
| 2740 | wfs 1.1.1 POST: optional |
| 2741 | */ |
| 2742 | if ((paramsObj->pszService == NULL || strlen(paramsObj->pszService) == 0) && |
no test coverage detected