Article: Getting Started With SharePoint Web Services

| by James Vastbinder Follow 0 Followers on Feb 06, 2008. Estimated reading time: less than one minute |

In this InfoQ exclusive article Trent Swanson provides an overview of  Microsoft Office SharePoint 2007 and its architecture.  In SharePoint, developers can use RPC which provides a more robust object model than web services however it does not support remote operations.  This is where web services must be utilized to support remote operations and gain interoperablity capabilities.

A solid understanding of IIS and ASP.NET is important when developing any SharePoint based solution.  Trent provides examples that walk through both .NET and Java in this introductory article on working with SharePoint web services.


Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


does Sharepoint support WSRP ? since I'd found any official resources about sharepoint interop through WSRP.

Java Sample Code Missing by Steve Reynolds

I do not see a link to download the aforementioned Java Sample Project. Am I just missing it?


XSD files by Garth Sweet

Very helpful article!
In the article you mention under the "Download the XSD files" section that we can "Download the XSD files from <here>...." but <here> isn't actually a link to anything. Can you point me to the XSD files?


Re: Java Sample Code Missing by Diana Baciu

Hello Steve

I've just added the download link.


Re: XSD files by Diana Baciu

Hi Garth

I've added a link for the zip file containing the XSD files


NTLM Authentication by Steve Reynolds

Thanks for posting the code. I have been trying to connect to the SharePoint Search Web Service via Axis2, but can not get it to work with NTLM Authentication. I am getting a similar error with your method: Exception in thread "main" request requires HTTP authentication: Unauthorized
I was wondering if any has tried this with NTLM Authentication. The SharePoint server I am connecting to has Basic Authentication turned off because it sends the credentials in plain text. Note: I provided a valid administrator username and password in Looking at the BindingProvider API, I don't see any other properties that I need to provide. I'm out of ideas.

Re: XSD files by tamer morsi

Thanks for uploading the docs,

The file; the article says: this file contains the XSD along with the completed project.
but there are no other files in the,
are their any missing files ?
thanks again

Re: NTLM Authentication by tamer morsi


check out:!A77124B9D...

// Setup Authentication parameters
String username = "Derek.Miller";
String password = "mypassword";
String host = "";
// NOTE: Important to ensure fully qualified domain name is used
String domain = "syddev01";
String realm = "syddev01";
int port = 80;

// Configure authenticator
HttpTransportProperties.Authenticator auth =
new HttpTransportProperties.Authenticator();

// Ensure NTLM authentication used
List authPrefs = new ArrayList(1);

// Get stub
ListsStub lists =
new ListsStub("");

// Set authenticator
(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
// Get request and execute
GetListCollection req = new GetListCollection();
GetListCollectionResponse res = lists.GetListCollection(req);
DisplayResult(req, res);

Re: XSD files by Floyd Marinescu

tamer, there’s another link in the article right below the image Java SharePoint Sample Project Directory and Root Files that contains the other archive (The full project and generated files are included along with couple, ...)

Re: XSD files by tamer morsi

Thanks but there should be another c# class, that is missing : Microsoft_Query_Request.c
This class is different from the generated xsd classes & is a wrapper class that the author refers to & the author says it is included in the xsd zip file ...
though i maybe wrong on this;
either way thnks

Re: XSD files by aladin sohaili

Hi Guys,
Thanks for the Article and for the different posts.

i modified the absolute path for the WSDL,and i modified the to point to my sharepoint server and to use the correct credentials.

i'm trying to run the code, i'm having this exception: request requires HTTP authentication: Unauthorized
at com.sun.xml.wss.jaxws.impl.SecurityClientPipe.process(

Thanks a lot for the help.

Re: NTLM Authentication by Kathryn Steel

I have tried this in Java and failed to get it to work with our server.
I can get basic-authentication working but we need to get at least basic authentication with SSL or NTLM working.
For SSL I get an
java.lang.RuntimeException: Object reference not set to an instance of an object.
Which suggest an object not populated that .NET is expecting.
I changed the URLS to be https:// for the ListsStub()

Authenticator auth = new Authenticator();
ArrayList authSchemes = new ArrayList();


copyStub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);

With NTLM I get Unable to respond to any of these challenges: {basic=Basic realm="melwwsinr08-basicauth"}
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized

HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();

// Ensure NTLM authentication used
List authPrefs = new ArrayList(1);
copyStub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);

Has anyone got working for SSL or can help further with NTLM ?

Re: NTLM Authentication by Kathryn Steel

Sorry I should also say for SSL I have set up
System.setProperty("", "c:/client.keystore");
System.setProperty("", "test12");
System.setProperty("", "JKS"); // JKS or PKCS12 ?

System.setProperty("", "c:/client.keystore");
System.setProperty("", "test12");
System.setProperty("", "JKS"); // JKS or PKCS12 ?
System.setProperty("", "ssl");
And I can see the SSL debug happenning and the application data content type 23 going over the wire encrypted but it gets an error. as I said saying Object reference not set to an instance of object coming back.

Re: NTLM Authentication by Ken Nagel

Did you ever get your answer? My guys are stuck here as well, and cannot get through NTLMV2 auth

Re: NTLM Authentication by Dilip Kumar Aerroju

PermissionsStub permissionsStub = new PermissionsStub("http://apstra-87lg198t:44894/_vti_bin/Permissions.asmx");
permissionsStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
GetPermissionCollection req1 = new GetPermissionCollection ();
GetPermissionCollectionResponse res1 = PermissionsStub.GetPermissionCollection(req1);

UserGroupStub groupStub = new UserGroupStub("http://apstra-87lg198t:44894/_vti_bin/usergroup.asmx");
groupStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
GetRoleCollectionFromUser collectionFromUser = new GetRoleCollectionFromUser();
GetRoleCollectionFromUserResponse collectionFromUserResponse = groupStub.GetRoleCollectionFromUser(collectionFromUser);

my problem is that very time authenticate for permission and userinfo. is there any way authenticate only once

Re: XSD files by ian smith

Does anyone know how the four XSD files were generated? Were they reverse engineered, or is this information available in a public place? I'm looking to interoperate with several sharepoint services using Java/JAXB.

org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized by Stefaan Somers

I'm pulling my hairs out for the moment. I've written some code, to get a list of sharepoint-lists. For some sharepoint sites, it works without any problem. But for other I always get the error : org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized.

There are 2 important questions I have :
- how can I check which authentication mechanism is used (NTLM or BASIC)
- can I get a more clear response, indicating me where the problem lies. Unauthorized is a bit too general. Moreover with the same user-name & password I can open the sharepoint URL for the list webservices.

If anyone wants I can send the jar-file so he can try out for himself. I create a test-sharepoint side, where you can work on.

Any help would be most welcome

Re: XSD files by HariKrishna Maharshi

Very useful article. Thanks.
Also, can you explain, how these XSD files were generated? Or can we get them from sharepoint server?
I wanted to interact with remaining services from the sharepoint server (from java).

Re: XSD files by HariKrishna Maharshi

Here is the link for Query schema on msdn site:

Re: XSD files by Markus Schmidt

Hi Aladin

I had the same problem and solved it by enabling Basic Authentication for the WebApplication in the central administration (Application Management -> Authentication Providers).

Hope that helps,

Re: XSD files by Peter Trein

has anyone tried connecting with WSS using Java?
This code:
BindingProvider bp = (BindingProvider)qsp;
//bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "Administrator");
//bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pass@word1");

doesn't work with ListsSoap.:/ I get error 401.

Anyone can help?

Re: XSD files by David Dudok de Wit

Hey Peter, I've covered your authentication problem in my tutorial that you will find here:
Reading a SharePoint list with Java: tutorial.

Basically the workaround to a lot of authentication problems (NTLM, SSL, ...) is to use a local copy of the WSDL file to generate stubs (just save it from your browser). After that, the Web Services just use a simple login/password problem.

I hope this helps.

David D.

Re: org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized by Peter Trein

Did you ever get the response for your post? I'm having the same problem.
NTLM authentication fails with org.apache.axis2.AxisFault: Transport error: 401 Error: Unathorized.
The question is: I have a user in a domain DOMAIN\user and the server is on port 8888. how to put it in the code because I believe this is a source of the problem?
My code:

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.apache.commons.httpclient.auth.AuthPolicy;

public class Test {

public static void main(String[] args) {
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername ("user");
auth.setPassword ("pass");
auth.setDomain ("DOMAIN");
List<String> authPrefs = new ArrayList<String>(1);
ListsStub lists;
try {
lists = new ListsStub();

lists._getServiceClient ().getOptions().setProperty (HTTPConstants.AUTHENTICATE, auth);
Options options = lists._getServiceClient().getOptions();
ListsStub.GetListCollection req = new ListsStub.GetListCollection();
ListsStub.GetListCollectionResponse res;
res = lists.GetListCollection (req);
} catch (AxisFault e) {
} catch (RemoteException e) {

Re: XSD files by Peter Trein

Hi David,
indeed you made some good job. Right now I'm having the problems as described in the post from yesterday. I will try with your new tutorial. Maybe it will work.


Re: QueryOptions by Leonid Sokolin

Can anyone provide an example of how to specify QueryOptions in the request?

I need to get a list of subfolders and it is apparently possible, if Folder option is specified as follows:


I am not sure though how to assign this value to GetListItems.QueryOptions.

ERROR_NO_RESPONSE by blue fish

I'm also struggling with java and sharepoint search/query service, unable to get any query to work.

I've dl the source, modified to point to our sharepoint server search.asmx/spsearch.asmx. Initially I got error 401, since our server only have windows authentication enabled; so I just enabled Basic auth, just for test purpose; I get response below.

Server Status: ONLINE

Response Status: ERROR_NO_RESPONSE

any help is greatly appreciated

Re: ERROR_NO_RESPONSE by blue fish

it turns out ERROR_NO_RESPONSE only happen with spsearch.asmx, not search.asmx anyone known why ?

also, how to get .xsd files (from java environment)?
I can only get wsdl file from sharepoint server.
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://myserver/_vti_bin/search.asmx"); //okay, got result

// bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://myserver/_vti_bin/spsearch.asmx"); //Server Status: ONLINE Response Status: ERROR_NO_RESPONSE

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

27 Discuss