Search code examples
javasharepoint-2010odatarestletatom-feed

Sharepoint 2010 oData Atom feed content properties parsing in Java


I am consuming a Sharepoint 2010 oData list using Java. Connection using SSL and NTLMv2 works well so far and I get a response with Atom format back. It seems like JSON format is disabled for Sharepoint. The next step is to efficiently parse the response to get the List entry content properties in Java.

I have a few options like use:

  • Rome to parse the feed response but that does not easily let me parse the content properties that I need.
  • oData4J - but it does not seem to support NTLM based authentication (based on documentation and open issues).
  • Restlet framework - has anybody used this to consume Sharepoint oData services that are secure and authenticated?
  • XML parsing

Any insight or experience with any of the above and what is recommended efficient approach?

The content properties I want to parse or get to are:

<m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
 <d:ContentTypeID xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">0x01005FC9ED59F2FC4842B6D</d:ContentTypeID>
 <d:Activity xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">Activity 1</d:Activity>
 <d:StartDate xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.DateTime">2012-04-16T00:00:00</d:StartDate>
 <d:EndDate xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.DateTime">2012-04-16T06:00:00</d:EndDate>
 <d:ActivityTypeValue xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:null="true" />
 <d:CreatedById xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.Int32">193</d:CreatedById>
 <d:ModifiedById xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.Int32">193</d:ModifiedById>
 <d:Id xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.Int32">357</d:Id>
 <d:ContentType xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">Item</d:ContentType>
 <d:Modified xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.DateTime">2012-03-30T13:07:18</d:Modified>
 <d:Created xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" m:type="Edm.DateTime">2012-03-30T11:35:42</d:Created>
 <d:Version xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">1.0</d:Version>
</m:properties>

Solution

  • In ROME you could create a custom module (Defining a Custom Module) for the dataservices namespace. That may be something other people would want to use as well.