获取“(401)未经授权”调用 SharePoint Web 服务时出错
我使用 Axis 1.4 从 http://10.0.0.22/_vti_bin/Lists.asmx
我使用以下代码访问 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 服务?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题是 IIS 上未启用基本身份验证。当我启用基本身份验证时,我可以访问 SharePoint Web 服务。
The problem is that Basic Authentication is not enabled on IIS. When I enable Basic Authentication, I can access SharePoint web serivce.
如果您有 ListsSoap12Stub,请尝试使用此方法而不是 ListsSoapStub。这对我有用。
If you have ListsSoap12Stub try this instead of ListsSoapStub. This worked for me.