code: public static String buildContextUrlFromOperationCall(ODataUri oDataUri, EntityDataModel entityDataModel,
                                                            boolean isPrimitive) {
          String serviceRoot = oDataUri.serviceRoot();
          String returnType = ODataUriUtil.getOperationReturnType(oDataUri, entityDataModel);
          return serviceRoot + "/" + METADATA + "#" + returnType + (isPrimitive ? "" : "/$entity");
      }
docs: Builds the 'Context URL' when the request is an action or function call.
  
  @param oDataUri        The odata uri
  @param entityDataModel The entity data model.
  @param isPrimitive     True if the context URL is for primitive.
  @return The built 'Context URL'.
  @see <a href=
  "http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793671">
  OData Version 4.0 Part 1: Protocol, paragraph 10.16</a>