Accessing SharePoint from Java
Posted by: Matt in Software development, Web tools, tags: java, SharePoint, web servicesI recently have been tasked with writing Java code to insert records into a SharePoint list, and I have been mildly successful, so I thought I’d share some of my experiences.
First, the important thing to know is that SharePoint’s API to stuff that’s not .NET is through Web Services. SharePoint exposes a large number of Web Services for doing stuff with their tool, but for this particular assignment there were two of primary interest: Lists and Views.
I’m a CXF guy (Axis2 works the same way), so to get started you get the WSDL, run WSDL2JAVA to generate a client and JAXB classes for the data types defined in the WSDL, and start going.
But here’s one part that really sucks: The schema in the WSDL defines many of the objects as type ANY, so when you access their JAXB objects, they contain exactly one member called “content” of type List<Object>. That’s right, you get back DOM nodes which you get to parse yourself. If you thought you’d get some rich object model for marshalling and unmarshalling your requests to the web service, think again. And not only do you get back lists of nodes as results — you get to build up a DOM for your requests too.
As I get more done, I will add more. Stay tuned.

Entries (RSS)
[...] Anyways, Matt said that he would be updating his readers on his journey of using Java to access SharePoint. Follow him here. His post on this topic is found here. [...]
I, for one, will be staying tuned to this. I’m still looking for some definitive articles and examples of accessing Sharepoint from java using web services. Right now, there seems to be just bits and pieces of information on it. I work on an java-based EAI system and we’re looking at integrating Sharepoint as one of the end-points.