Tran Dinh Thoai
Tran Dinh Thoai

Reputation: 702

Get '(401)Unauthorized' error when calling SharePoint web service

I use Axis 1.4 to generate java classes from http://10.0.0.22/_vti_bin/Lists.asmx

I use following code to access web service:

javax.xml.rpc.Service service = new ListsLocator();
ListsSoapStub stub = SharePointWSDL.newLists(new URL("http://10.0.0.22/_vti_bin/Lists.asmx"), service);
stub.setUsername(username);
stub.setPassword(password);
com.microsoft.schemas.sharepoint.soap.GetListCollectionResponseGetListCollectionResult lcr = stub.getListCollection();

I get "(401)Unauthorized" error.

How can I use java classes which are generated by Axis to access SharePoint web service?

Upvotes: 0

Views: 3018

Answers (2)

itsme_seenu
itsme_seenu

Reputation: 340

If you have ListsSoap12Stub try this instead of ListsSoapStub. This worked for me.

Upvotes: 0

Tran Dinh Thoai
Tran Dinh Thoai

Reputation: 702

The problem is that Basic Authentication is not enabled on IIS. When I enable Basic Authentication, I can access SharePoint web serivce.

Upvotes: 1

Related Questions