3.2.5.10 Executing a Received Invoke Function Request

The directives defined in this section apply when executing a received Invoke Function request, as specified in Invoke Function Request (section 2.2.7.5.2).

The server MUST validate that the HTTP request URI identifies a function exposed by the data service. If this validation fails, a 4xx response code MUST be returned. If the validation succeeds, the server MUST read all required input parameter values from the request URI (section 2.2.7.5.2).

If the server has multiple FunctionImport elements with the same Name (that is, a function has overloads), the server SHOULD use the parameter types and parameter names that are provided to resolve which FunctionImport is to be invoked. If the server fails to resolve the request to a specific FunctionImport, the server MUST not execute any FunctionImport and MUST instead return a 4xx response code.

If any of the parameter values are malformed, a 4xx response code MUST be returned. If the request URI is valid, the server MUST invoke the FunctionImport, as specified in [MC-CSDL], associated with the function by using the parameter values specified in the request URI.

If a FunctionImport is invoked with no parameter names mentioned in the URI path and a required parameter is not present in the query string, the server SHOULD pass null for the parameter value to the function.

If the parameter type is not nullable, as specified in [MC-CSDL], a 4xx response code MUST be returned.

If the FunctionImport, as specified in [MC-CSDL], is invoked successfully, the return value MUST be serialized according to the syntax rules defined in Invoke Request Types (section 2.2.7.5).

If the Invoke Function request is bound to a resource that does not exist on the server, the server MUST return a 404 response code.

If the Invoke Function Request is bound to a resource that does not support the function, the server MUST return a 405 (Method Not Allowed) response code.