views:

289

answers:

2

Can anyone tell me how to call sharepoint 2007 webservices from java? And what is the xml format to send a soap request to sharepoint 2007 ?

I am using java1.5.

A: 

Java 6 has built in support for web services. You will most likely need an IDE to help you create Java classes from the WSDL. I found IntelliJ IDEA to create a good client based only on the Java 6 runtime, and no third party jars.

Thorbjørn Ravn Andersen
+2  A: 

Disclaimer: I've tested this with Java 1.6. Let me know if it works for you.

Let's say you want to do a basic operation, like reading a SharePoint List from Java. The easiest way i found to access SharePoint's Lists Web Services from Java is to:

  1. Manually download the Lists.asmx WSDL from your browser. This way you'll avoid having to deal later with the NTLM authentication of your SharePoint site (you'll use basic auth instead). The URL to your WSDL should look like: sharepointsite.com/_vti_bin/Lists.asmx?WSDL
  2. Generate the stub classes from your WSDL with your favorite Java IDE, like NetBeans, or do it from the command line with the following command (for the Win32 JDK):

[Java-JDK-path]\bin\wsimport.exe” -p com.microsoft.schemas.sharepoint.soap -keep -extension Lists.wsdl

The code necessary to get authentified and to read the SharePoint List from Java is a bit too long to post here. I'd recommend reading this tutorial which covers the authentication, SOAP request construction, and result interpretation.

I hope this helps.

DavidD