1

I have a custom service written in .Net to fetch component data. This service uses SDL Web Delivery V 8.1.1 APIs and deployed on Delivery Server. I have separate servers for content and delivery. In this service I fetch componentpresentation using GetComponentPresentationWithPriority method of componentpresentation factory. I'm getting following error:

Invalid v4 service endpoint for content-service at Sdl.Web.Delivery.ContentService.AutoConfigure.get_ODataV4ServiceEndpoint() at Sdl.Web.Delivery.ContentService.ContentServiceProvider..ctor() at Sdl.Web.Delivery.ContentService.ContentServiceProvider.get_Instance() at Sdl.Web.Delivery.Dynamic.ComponentPresentationFactory.RetrieveComponentPresentation(Int32 paramPublicationId, String methodName, Object[] parameters) at Sdl.Web.Delivery.Dynamic.ComponentPresentationFactory.GetComponentPresentationWithPriority(Int32 componentId, Int32 priority) at Tridion.ContentDelivery.DynamicContent.ComponentPresentationFactory.GetComponentPresentationWithPriority(Int32 componentId, Int32 priority)

I have checked contentservice capability is set in discovery service and also re-run the utility to update capabilities. Tried using both http://localhost:8081//client/v4/content.svc and http://localhost:8081/content.svc endpoints for content service. Both give same error. The auth is also disabled for discovery and content service.

MORE INFO: When I try

ComponentPresentation cp1 = cpf.GetComponentPresentationWithHighestPriority(URI);

there is no error, but cp1 is null. I can see in broker DB content exists. And it happens for all components.

but at same time

ComponentPresentation cp = cpf.GetComponentPresentationWithPriority(componentId, priority);

throws above error.

I'm wondering how the API connects to content service and where it gets connection string from? I have tried modifying Tridion_Home and adding lib/config folder in bin folder of my custom service. But no success.

  • url has double slashes after port ? – vinayknl Jun 9 '16 at 11:43
  • Yes, url has double slashes. I used this since localhost:8081/content.svc gives me urls for v2 and V4 in this format. But even using single slash doesn't make any difference. – wads Jun 9 '16 at 11:46
4

Content Delivery Dot Net API connects to Content Service based on the ContentServiceCapability configuration obtained from discovery service. So, it requires discovery service end point configured in Web.config as property discovery-service-uri.

GetComponentPresentationWithPriority is returning null because it handles exception (it logs exception which may be similar).

Check if your client has the discovery service end point configured properly and it is connecting it to fetch correct ContentServiceCapability.

  • Thanks vinayknl, this works fine. In fact, before your answer I was able to get it working by adding content service uri in web config with key 'content-service-uri'. So either add 'discovery-service-uri' or add 'content-service-uri' in web.config of custom service and both work ok.Also the content service capability url configured in discovery service storage config should point to root of content service (http:localhost:8081/content.svc) and not version specific. – wads Jun 13 '16 at 7:50
  • Ideally, use discovery-service-uri instead, as this would allow you to move your content service (or scale it, or whatever) without needing to change the configuration of your client webapp. Glad you found it though. – Nuno Linhares Dec 12 '16 at 12:47
2

Your storage configuration points directly to the v4 version, but some commands need the v2 so you will get errors this way. You should just point to the root of the service, like so: http://localhost:8081/content.svc

The CD client API knows which endpoint to go to, so you don't have to worry about whether it is v2 or v4.

  • Hi Peter, I tried that as well. In fact earlier I had endpoint localhost:8081/content.svc configured in discovery storage config. But still I was getting same error, then I did try out various options and changed the endpoint to v4 specific. – wads Jun 9 '16 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.