开发者

How to call sharepoint 2007 webservices through java?

开发者 https://www.devze.com 2022-12-16 22:20 出处:网络
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开发者_开发问答 ?

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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号