SmartObject OData API - SmartObjects do not show up in OData feed
After selecting SmartObjects to be exposed via the SmartObject OData API, they do not show in the OData feed, although they get listed under SmartObjects in the SmartObject OData API section of the K2 Management site.
SymptomsNo error message is presented when you add or remove them from this list.
It is possible to enable additional diagnostic logging to troubleshoot/verify the root cause of this issue. To enable logging in [Install directory]WebServicesAPISmartObjectService.OData edit the web.config and comment out the following part under :
Right above the commented line, add the following new line:
Save the web.config file - no IIS reset is required. Providing the folder path in the line above is valid for your system (if not adjust as necessary). You will see two log files in the following location:
C:Program Files (x86)K2 blackpearlWebServicesAPILogs
You may see the following error message logged in the diagnostics logs in this scenario:
System.TypeInitializationException: The type initializer for 'SmartObjectService.Web.Extensions.StringExtensions' threw an exception. ---> System.NotImplementedException: The culture 'German (Germany)' is not supported. Pluralization is currently only supported for the English language.
at System.Data.Entity.Design.PluralizationServices.PluralizationService.CreateService(CultureInfo culture)"
The keywords in this error message are: "The culture 'German (Germany)' is not supported. Pluralization is currently only supported for the English language."
This error message is related to region and language settings. When you click Apply, OData API tries to pluralize the name of the SmartObject to create the route name and publish the $metadata.
If you have "Customer" as a SmartObject name, the OData API will publish "/Customers". This issue is caused by the fact that the culture settings (Regions (intl.cpl) > Format > Format) is not set to English for the K2 Service and/or the K2 Application Pool account, because of this, the OData API fails to pluralize, and consequently also fails to create the route for the SmartObject (thus fails to publish the SmartObject).
To resolve this, it is necessary to append [K2dir]WebServicesAPISmartObjectService.ODataWeb.config with the following setting:
The format for the culture name based on RFC 4646 is languagecode2-country/regioncode2, where languagecode2 is the two-letter language code and country/regioncode2 is the two-letter subculture code. Examples: en-GB for English (United Kingdom) and en-US for English (United States). In cases where a two-letter language code is not available, a three-letter code derived from ISO 639-2 is used. Standards recommend use of lowercase for language codes and capitalization of country codes.
For more information on two letter language codes (languagecode2) refer to ISO 639-1
For more information on two letter country codes (country/regioncode2) refer to ISO 3166-1 alpha-2
There is a possibility to use "auto" as a value for this setting which means that culture to use will depend on browser/base OS language settings.
This has to be placed under <system.web>
Next, perform an IIS reset. Usually just editing the web.config is sufficient because a config change restarts the web app but in this case PluralizationService gets created as a read-only static object, so you would have to restart the service to get it set with the new culture.
Your other option to resolve this can be to set both the K2 Service and K2 Application Pool accounts to use English format settings.