Question

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;
    }
Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top