3

I'm using the UGC web service to return UGC content but I have an issue in that users are being returned as null. The users are being entered into the UGC database - I can see users in both the UGC_USERS table and the UGC_ITEMS tables but when it comes to retrieving the comments using the odata.svc the user is coming back as null.

WebServiceClient ugcCall2 = new WebServiceClient();
Uri uri = new Uri("http://new.ugc.service/odata.svc");
CDS.ContentDeliveryService cds = new CDS.ContentDeliveryService(uri);
var comments = client.Comments;

Does anyone know why this would be the case? Audience Manager isn't plumbed in at this point. We're simply adding comments from a domain user - the username is appearing in the UGC database but the user is coming back as null when we retrieve the comments from odata.

Thanks

John

Daniel Neagu
  • 1,711
  • 11
  • 13
John
  • 271
  • 2
  • 5

3 Answers3

3

John,

Make sure you're using the Expand method in your calls:

client.Comments.Expand("User")

This will ensure the full User data is also part of the results.

You can see it clearly if you query Odata directly:

odata.svc/Comments?$expand=User

Cheers

Neil
  • 2,688
  • 1
  • 23
  • 32
  • Well what do you know that was the answer. ;) To expand on this, we were wondering why odata was returning user data but when we loaded odata into CDS then the user object was null. As Neil pointed out, once the expand method was called then the user data was available to us. – John Feb 25 '13 at 09:58
1

It seems like a case of mis(-un)configured Ambient Data Framework (ADF). Make sure ADF is configured on your website -- that is the server from where you are making the call to the OData service.

ADF is responsible with sending your client information (e.g. user id, cookies, session id, etc) from a machine to another. It seems like in your case the communication to OData is done without this information. This points to an ADF not being configured properly. Check again the documentation of UGC on how to configured it.

BTW, your example code is not very clear, what it client ?

Mihai Cădariu
  • 2,407
  • 14
  • 17
  • But I though the OData service was designed to supply content to "third parties" of any framework - are you saying they'd need ADF on their side just to read comments from the service? – Neil Feb 25 '13 at 08:41
0

As Mihai said, make sure that the UGC ambient cartridge is configured on both the UGC CD Webservice as the (staging or live) website. If this is not done users will be registered with ID null.

Also see my blog for more common issues when installing UGC:

http://80000ft.blogspot.nl/2012/08/common-issues-while-installing-ugc.html

Arjen Stobbe
  • 1,684
  • 9
  • 15
  • John's comment suggests that users *are* being registered - they appear in the UGC_USERS table. If they are in the db why wouldn't they be part of a resultset returned by OData? – Neil Feb 25 '13 at 08:58
  • If I remember correctly users are registered but their ID is set as NULL. Maybe someone can confirm? – Arjen Stobbe Feb 25 '13 at 09:00