File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Microsoft Sharepoint web services from java client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Microsoft Sharepoint web services from java client" Watch "Microsoft Sharepoint web services from java client" New topic
Author

Microsoft Sharepoint web services from java client

sudeep jha
Greenhorn

Joined: Sep 05, 2007
Posts: 19
How to connect Microsoft Sharepoint services through its web services from java client?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Do you have a WSDL description of the available WS? If so, any of the commons Java SOAP toolkits (Axis, Metro, ...) can generate the client-side classes to access them.


Ping & DNS - updated with new look and Ping home screen widget
Matt Zollinhofer
Ranch Hand

Joined: Jul 09, 2004
Posts: 33
The WSDL should be located at something like: https://<yoursharepointserver>/_vti_bin/lists.asmx?WSDL

The WSDL above would be the WSDL to work with lists. See here: http://msdn.microsoft.com/en-us/library/cc752745.aspx for other WSDLs and here: http://msdn.microsoft.com/en-us/library/lists.lists_methods.aspx for more details about using the list api.

Let us know, with a little more detail, what you need help with.
Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9


Have you been successful in doing this?
I am also trying to call the sharepoint webservice but I am getting 401-Unauthorized error from IIS.
Can you tell me how to set these credentials?
Matt Zollinhofer
Ranch Hand

Joined: Jul 09, 2004
Posts: 33
yes I am able to connect and interact with sharepoint. I'm not sure if you're getting that error when connecting to the WSDL or once you're using the classes you generated from the WSDL. assuming the ladder, you should be able to do something like this:

Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9

Actually I have created a custom web service and generated its client using NetBeans IDE.
But as the basic authentication is enabled on IIS on which the Sharepoint is deployed, when I run my java code I got 401(Unauthorized) exception.
So I think there must be some code for setting the username/password in my client code.
If you can provide me that code..It will be great

Thanks
Gaurav
Matt Zollinhofer
Ranch Hand

Joined: Jul 09, 2004
Posts: 33
I thought I did that, but maybe I'll try again...does this make more sense?



I'm not sure how netbeans generates things but I think it'll be something resembling the above code. some class names will probably be different...
Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9
Thanks Matt
I will try this one and please try to find in case it doesn't work.....
Narasimha Reddy Chanda
Greenhorn

Joined: Jul 25, 2007
Posts: 2

Matt Zollinhofer wrote:I thought I did that, but maybe I'll try again...does this make more sense?



I'm not sure how netbeans generates things but I think it'll be something resembling the above code. some class names will probably be different...


Are you using eclipse and axis 1.x to generate the code??
Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9
No....I am using NetBeans and I have successfully invoked the sharepoint web service...
But the problem is that it is working only when I generate RPC client.....and enable basic authentication.
Means it doesn't work for JAX-WS client and/or another authentication like Digest authentication..
charlie silver
Greenhorn

Joined: Apr 17, 2009
Posts: 3
Hi,

Were you able to find a solution to your problem?

I have the same situation. I am able to generate the services references with netbeans using the wsdl but I am getting the 401 error every time I try to use the service in my code.

I tried Matt's solution but the soap12 method does not allow me to pass any parameters in it, like this:


Is there something that needs to be done in sharepoint's side?

Thanks.
Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9
Hi Charlie,

I don't have any idea about the code you pasted over here.
I have only created the JAX-RPC client using netbeans 6.1, enabled basic authentication and removed other authentications on IIS where SPS is deployed.

Thanks
Gaurav

charlie silver wrote:Hi,

Were you able to find a solution to your problem?

I have the same situation. I am able to generate the services references with netbeans using the wsdl but I am getting the 401 error every time I try to use the service in my code.

I tried Matt's solution but the soap12 method does not allow me to pass any parameters in it, like this:


Is there something that needs to be done in sharepoint's side?

Thanks.
charlie silver
Greenhorn

Joined: Apr 17, 2009
Posts: 3
Hi Gaurav,

Gaurav Jain newbie wrote:Hi Charlie,

I have only created the JAX-RPC client using netbeans 6.1, enabled basic authentication and removed other authentications on IIS where SPS is deployed.


What other authentications did you remove in IIS?

Thanks for the tips man
Gaurav Jain newbie
Greenhorn

Joined: Jun 23, 2009
Posts: 9
I don't remember exactly. But try having only Window Integrated authentication and Basic Authentication and remove all other like digest authentication etc.
charlie silver wrote:Hi Gaurav,

Gaurav Jain newbie wrote:Hi Charlie,

I have only created the JAX-RPC client using netbeans 6.1, enabled basic authentication and removed other authentications on IIS where SPS is deployed.


What other authentications did you remove in IIS?

Thanks for the tips man
harish kanuri
Greenhorn

Joined: Mar 15, 2006
Posts: 2
Hi,

I am new to WebServices and currently working on JAX WS 2.1 to access Sharepoint webservices. I need to access the data in the Lists of sharepoint site, so I used /_vti_bin/lists.asmx. I am using NetBeans 6.5 to generate the WebService References and could access Sharepoint (without any authentication issues). I found that I am getting a response object, however I am unable to extract the data from the response object. I found that the result (response object) consists of a list of objects of type ElementNSImpl and again each of them consisted of list of ElementNSImpl objects. Found that some contained text objects which contained some weird values, numbers. I could know exactly how to extract the data from the result. I really appreciate your help and please throw some light on how to retrieve data from result object. Also let me know if you need more details

Below is the generated code from NetBeans for the WebService Refernce(Made changes to access sharepoint, didnt have to add any code for authentication):

URL baseUrl = com.microsoft.schemas.sharepoint.soap.Lists.class.getResource(".");
try { // Call Web Service Operation
com.microsoft.schemas.sharepoint.soap.Lists service = new com.microsoft.schemas.sharepoint.soap.Lists(new URL(baseUrl, "http://website/sites/itarchitecture/ssr/webservicetest/_vti_bin/lists.asmx?wsdl"), new QName("http://schemas.microsoft.com/sharepoint/soap/", "Lists"));
com.microsoft.schemas.sharepoint.soap.ListsSoap port = service.getListsSoap12();
// TODO initialize WS operation arguments here
java.lang.String listName = "testList";
// TODO process result here
com.microsoft.schemas.sharepoint.soap.GetListResponse.GetListResult result = port.getList(listName);
System.out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}

Thanks in advance!
Ankush Basak
Greenhorn

Joined: Jan 06, 2010
Posts: 1
SharePoint Webservices are JAX-RPC or SOAP/HTTP compatible?

If so then how? Please help me.
Pin Ping
Greenhorn

Joined: Jan 08, 2010
Posts: 2
I can call the sharepoint web services from java client if sharepoint uses basic authentication.

ServiceSoapStub serviceSoapStub = new ServiceSoapStub(new URL(Service_URL), null);
serviceSoapStub.setUsername(USERNAME);
serviceSoapStub.setPassword(PASSWORD);

result = serviceSoapStub.getListItems(...);

But if sharepoint uses Kerberos authentication, and my java side (WebSphere portal) is also using Kerberos, what should I do to make the web service call?

Have anyone done that? (Microsoft sharepoint web service from Websphere Portal with both Kerberos authentication)

Thanks
markendef allen
Greenhorn

Joined: Jan 09, 2010
Posts: 2
Thanks For Sharing

Peter Crossworth
Greenhorn

Joined: Jan 28, 2010
Posts: 1
Hi!

Anyone using WSS 3.0 and calling web service with java?
After making the job on wsimport we don't have ListsSoap12 class or ListsStub
How do we authenticate to WSS without this class? WSS is set to simple authentication .

I appreciate any help.

Gangelster
Emanuel Chmal
Greenhorn

Joined: Aug 22, 2012
Posts: 2
Hi,

I would like to access lists in sharepoint but i don't know how to connect. I have another wsld file because there are different classes. Can you help me ?

I'm using Eclipse.

Here is my wsld file: Wsld file

Thanks
Harish Gulati
Greenhorn

Joined: Jan 22, 2013
Posts: 1


Hi,

I might be waking the deads on this thread, I tried to call sharepoint's Lists web service with Axis2, Axis1.4. I am getting 401 Unauthrozed every time, some one has a working code??? it will be a great help, i have been googling for hours now

Regards,
Harish




Harris

 
Consider Paul's rocket mass heater.
 
subject: Microsoft Sharepoint web services from java client
 
Similar Threads
Aspose.Newsletter April 2011 Edition is out now
Aspose.Newsletter December 2010 Edition is out now
java client for sharepoint webservices
How to manipulate SharePoint using java
Microsoft Sharepoint web service from Java client