[英]Get '(401)Unauthorized' error when calling SharePoint web service
我使用Axis 1.4從http://10.0.0.22/_vti_bin/Lists.asmx生成Java類
我使用以下代碼訪問Web服務:
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();
我收到“(401)未經授權”錯誤。
如何使用Axis生成的Java類訪問SharePoint Web服務?
問題是在IIS上未啟用基本身份驗證。 啟用基本身份驗證后,我可以訪問SharePoint Web服務。
如果您有ListsSoap12Stub,請嘗試使用它代替ListsSoapStub。 這對我有用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.