This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
You may experience various issues when trying to register/refresh the OData service instance in K2.
When trying to register/refresh OData service instance in K2 you may receive the following errors:
1. "VALIDATIONThe ‘Name’ attribute is invalid 0 The value ‘%Attribute_Name% ’ is invalid according to its datatype ‘http://schemas.microsoft.com/ado/2007/05/edm:TSimpleIdentifier’ – The Pattern constraint failed. "
2. SmartObject Server Exception: Error refreshing Service Instance ‘%SI_Name%’. Service returned: ‘Compile Error: CS0013 – Unexpected error writing metadata to file ’%AppData%\Local\Temp\%SI_Name%’ – ‘No logical space left to create more user strings.’
1. This error is not thrown by K2 but by EntityClassGenerator which K2 uses to generate the assembly code, the same errors can be seen in Visual Studio. The rules for the naming convention will be the same as for creating attributes in a C# class etc.
2. This error occurs when the assembly is too large with strings as per .Net limit. You can try and split the OData assembly in two - the K2 Documentation reflects the following:
K2’s OData Broker uses the same code generation technology as Visual Studio – the OData Client Code Generation Tool
and K2 has no plans to change the code generation technology used by OData broker. Any change requests for the Code Generation Tool capabilities should be logged with Microsoft directly. Customers can test their OData endpoint compatibility with the code generation tool by using Visual Studio to add a Service Reference. For example, using the endpoint https://data.wa.gov/OData.svc
you will see that Visual Studio cannot consume this endpoint because it has invalid information. Likewise, K2 will not be able to consume this endpoint in our OData broker.
In this particular case, the service provider has lots of other API options and can likely be consumed via Swagger and K2 REST broker when the OData broker does not work.