0

I'm using a linq statement like the one below to return a page. The page returns, the content field is populated in the DB, but the Content is null in the OData response. Any ideas?

     var pages = (from p in cds.PageContents
                 where p.PublicationId == 20 && p.PageId == 1397
                 select p).ToList<SDLODataClient.SDLOData.PageContent>();

    foreach (SDLODataClient.SDLOData.PageContent p in pages)
    {
        txtOutput.InnerHtml += p.Content;
    }
Daniel Neagu
  • 1,711
  • 11
  • 13
Mr Smith
  • 2,774
  • 9
  • 38
  • 72

2 Answers2

0

Your code works perfectly if you actually have all the needed data in the Broker database. The only cases in which the code does not work properly are when: you do not have the correct configuration for your webservice or when you don't have the PageMeta in the Broker database (check the PAGE table for rows with PUBLICATION_ID=20 and ITEM_REFERENCE_ID=1397) or when you don't have the PageContent in the Broker database (check the PAGE_CONTENT table for rows with PUBLICATION_ID=20 and PAGE_ID=1397).

The simplest test that you can do is to try to access the entry yourself by going in your browser to '.../odata.svc/PageContents(PageId=1397,PublicationId=20)'. If this URL does not work then you need to set the OData Webservice logging to DEBUG (check logback.xml) and to search for ERROR messages related to pages/queries.

Hope this helps.

Daniel Neagu
  • 1,711
  • 11
  • 13
0

This turned out to an issue with my cd_storage_conf.xml config file. Everything should have been pointed to the broker DB, but one item mapping was defined as follows:

<Item typeMapping="Page" cached="false" storageId="defaultFile"/

So the OData service was not looking in the right place.

Mr Smith
  • 2,774
  • 9
  • 38
  • 72