+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Adding RelatedMedia property to News content type causes System.InvalidOperationException

Adding RelatedMedia property to News content type causes System.InvalidOperationException

2 posts, 0 answered
  1. robert
    robert avatar
    1 posts
    Registered:
    08 Apr 2016
    21 Jul
    Link to this post

    Hello,

    I am currently developing against an Sitefinity v9.1 and working with WebServices to return data back for our News Items.

    When I add any field to the News Item with the type of 'Related Media' from the drop-down choices, the web service calls begin to fail. When I look at the web service's property mapping of the new field, its the following:

    Resolver Type: Telerik.Sitefinity.Web.Services.Contracts.RelatedDataPropertyResolver

    The web service call being used is: /mycustomwebservice/newsitems

    The service call works perfectly without that field added.

    The exception that's being returned in the result from the web service call is below.

     

    Thank you in advance to anyone able to help with this problem.

     

    EDIT: 7/26/2016 13:54 PST

    Hello everyone,

    I wanted to update this original post with some more information. I recently just finished testing these exact same changes using the Sitefinity Sample EmptyProject found here: https://github.com/Sitefinity-SDK/Telerik.Sitefinity.Samples.EmptyProject/tree/release91  and I am able to reproduce the exact same problem.

    I have also attached screenshots of the custom field for the content type and the property mappings of the web service call. Note that the exception's stack trace was from our Staging server where the fields name was 'TestAttachment' but in the screenshots the field name is 'Attachment' so pay no mind to the different names. I hope this new testing brings light to this issue.

     

    {
      "Message": "An error has occurred.",
      "ExceptionMessage": "Relation with name TestAttachment did not find the opposite type Telerik.Sitefinity.Libraries.Model.Document registered.",
      "ExceptionType": "System.InvalidOperationException",
      "StackTrace": "   at Telerik.Sitefinity.Web.Api.OData.Model.DefaultEdmTypeBuilder.MapAssociation(Type relatedClrType, String alias, Boolean containsTarget, Boolean multiple)\r\n   at Telerik.Sitefinity.Web.Api.OData.Model.DefaultEdmTypeBuilder.MapCustomNavigationProperties()\r\n   at Telerik.Sitefinity.Web.Api.OData.Model.ConfiguredEdmModel.BuildConfiguredType(String typeFullName, String setName)\r\n   at Telerik.Sitefinity.Web.Api.OData.Model.ConfiguredEdmModel.Init(IEnumerable`1 types)\r\n   at Telerik.Sitefinity.Web.Api.OData.Model.EdmModelWrapper.GenerateModel()\r\n   at Telerik.Sitefinity.Utilities.ConcurrentProperty`1.get_Value()\r\n   at Telerik.Sitefinity.Web.Api.OData.Model.EdmModelWrapper.get_EntityContainer()\r\n   at Microsoft.OData.Edm.ExtensionMethods.FindDeclaredEntitySet(IEdmModel model, String qualifiedName)\r\n   at Microsoft.OData.Edm.ExtensionMethods.FindDeclaredNavigationSource(IEdmModel model, String qualifiedName)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.TryCreateSegmentForNavigationSource(String identifier, String parenthesisExpression)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.CreateFirstSegment(String segmentText)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathParser.ParsePath(ICollection`1 segments)\r\n   at Microsoft.OData.Core.UriParser.Parsers.ODataPathFactory.BindPath(ICollection`1 segments, ODataUriParserConfiguration configuration)\r\n   at Microsoft.OData.Core.UriParser.ODataUriParser.Initialize()\r\n   at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath, ODataUriResolverSetttings resolverSettings, Boolean enableUriTemplateParsing)\r\n   at System.Web.OData.Routing.DefaultODataPathHandler.Parse(IEdmModel model, String serviceRoot, String odataPath)\r\n   at System.Web.OData.Routing.ODataPathRouteConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)\r\n   at Telerik.Sitefinity.Web.Api.OData.Routing.DynamicODataConstraint.Match(HttpRequestMessage request, IHttpRoute route, String parameterName, IDictionary`2 values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraint(HttpRequestMessage request, Object constraint, String parameterName, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.ProcessConstraints(HttpRequestMessage request, HttpRouteValueDictionary values, HttpRouteDirection routeDirection)\r\n   at System.Web.Http.Routing.HttpRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)\r\n   at Telerik.Sitefinity.Web.Api.OData.Routing.CompositeRoute.GetRouteDataInternal(String virtualPathRoot, HttpRequestMessage request)\r\n   at Telerik.Sitefinity.Web.Api.OData.Routing.CompositeRoute.GetRouteData(String virtualPathRoot, HttpRequestMessage request)"
    }

  2. robert
    robert avatar
    1 posts
    Registered:
    08 Apr 2016
    02 Aug
    Link to this post

    Hello everyone,

    I just wanted to update this thread with more information after trying to use the $expand in the web service call, it still results in an exception. Please see attached screenshots. 

2 posts, 0 answered