Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Microsoft Sharepoint web services from java client

 
sudeep jha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to connect Microsoft Sharepoint services through its web services from java client?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matt Zollinhofer
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Matt
I will try this one and please try to find in case it doesn't work.....
 
Narasimha Reddy Chanda
Greenhorn
Posts: 2
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SharePoint Webservices are JAX-RPC or SOAP/HTTP compatible?

If so then how? Please help me.
 
Pin Ping
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks For Sharing

 
Peter Crossworth
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic