Dido, thanks for your reply. I tried all of your suggestions but I still got the same error message:
Telerik.Sitefinity.Web.Services.CollectionContext`1[InstaOrderOpenAccess.TestManufacturer] cannot be serialized because it does not have a parameterless constructor.
After a lot of trial and error, we have discovered the source of the problem.
(Sorry I cannot seem to highlight my text like you were somehow able to!)
"Get all test manufacturers"
ResponseFormat = WebMessageFormat.Json)]
[WebHelp(Comment = "Get all test
ResponseFormat = WebMessageFormat.Xml)]
, BodyStyle = WebMessageBodyStyle.Bare,
, BodyStyle =
WebMessageBodyStyle.Bare, ResponseFormat= WebMessageFormat.Xml)]
The problem is with the second defined method, GetTestManufacturersInXml.
As suggested in the documentation, I have been creating two
methods for each resource to be returned. One method, returns Json
and the other method returns Xml
(with the URITemplate having the extra piece of the path "/xml").
Naturally, I had created two methods to return all manufacturers: The first method, GetTestManufacturers
, returned a List<TestManufacturer> in Json and the second method, GetTestManufacturersInXml
, returned a List<TestManufacturer> in Xml format. These are the first two methods in the code sample above.
I then wanted to bind the results of the GetTestManufacturers
method to a RadGridBinder control, so I changed the original return type of GetTestManufacturers
from List<TestManufacturer> to CollectionContext<TestManufacturer>.
This is where the error was introduced. Apparently you cannot have a method that returns its data in Xml format to return a class of type CollectionContext<>. The mere existence of such a method causes all methods to fail.
When I commented out the GetTestManufacturersInXml
method, everything started working.