积极答复者
How to access SharePoint site through java

问题
-
I want access my sharepoint site through java, I use the SharePoint's webservice,but it need credentials, and I don't know how to fill this credentials in java.
below is some code in .Net
WSLists.Lists wslists = new WSLists.Lists();
wslists.Credentials = new System.Net.NetworkCredential("administrator", "pass@word1", "mosing");can someone give me some advise or some samplecode? thanks ....
答案
-
Hi Marbury,
ListsSoapStub is your referenced Web Service class name, the above code is a sample code, if your referenced Web Service class name is other(based on your customize), you can use the custom class name. The point of your issue is how to use Java call Web Service, you can go to some professional java forums to get better support, for example:
https://forums.oracle.com/forums/forum.jspa?forumID=922
Thanks,
Lhan Han
- 已标记为答案 Lhan HanModerator 2012年4月6日 3:30
- 已编辑 Lhan HanModerator 2012年4月6日 6:34
全部回复
-
Hi Marbury,
The following code is a sample that retrieve SharePoint List records through Web service call (Java Client) using getListItems method:
ListsSoapStub stub;
ListsLocator locator = new ListsLocator();URL url = new URL(“https://portal.ant.amazon.com/sites/vija/_vti_bin/Lists.asmx”);
stub = (ListsSoapStub)locator.getListsSoap(url);
stub.setUsername(“ANT\\vija”);
stub.setPassword(“p0o9I8U7″);
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, “ANT\\vija”);
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, “p0o9I8U7″);
stub._setProperty(“http.username”, “ANT\\vija”);
stub._setProperty(“http.password”, “p0o9I8U7″);
// ListsSoap ls = locator.getListsSoap();
GetListItemsQuery q = new GetListItemsQuery();
//GetListItemsResponseGetListItemsResult a = stub.getListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID)GetListItemsResponseGetListItemsResult a = stub.getListItems(“1D871423-1413-46FD-BEF2-2F737E566267″, “”, null, null,”1″, null, “”);
MessageElement[] m = a.get_any();
MessageElement me = m[0];System.out.println(me.getAsString());
For more information, please refer to the following link:
https://vinodjayachandran.wordpress.com/2009/09/16/read-sharepoint-list-through-web-servicejava-client-from-getlistitems-method/
http://davidsit.wordpress.com/2010/02/10/reading-a-sharepoint-list-with-java-tutorial/
Thanks,
Lhan Han- 已编辑 Lhan HanModerator 2012年4月3日 9:23
-
Hi Marbury,
The following code is a sample that retrieve SharePoint List records through Web service call (Java Client) using getListItems method:
ListsSoapStub stub;
ListsLocator locator = new ListsLocator();URL url = new URL(“https://portal.ant.amazon.com/sites/vija/_vti_bin/Lists.asmx”);
stub = (ListsSoapStub)locator.getListsSoap(url);
stub.setUsername(“ANT\\vija”);
stub.setPassword(“p0o9I8U7″);
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, “ANT\\vija”);
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, “p0o9I8U7″);
stub._setProperty(“http.username”, “ANT\\vija”);
stub._setProperty(“http.password”, “p0o9I8U7″);
// ListsSoap ls = locator.getListsSoap();
GetListItemsQuery q = new GetListItemsQuery();
//GetListItemsResponseGetListItemsResult a = stub.getListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID)GetListItemsResponseGetListItemsResult a = stub.getListItems(“1D871423-1413-46FD-BEF2-2F737E566267″, “”, null, null,”1″, null, “”);
MessageElement[] m = a.get_any();
MessageElement me = m[0];System.out.println(me.getAsString());
For more information, please refer to the following link:
https://vinodjayachandran.wordpress.com/2009/09/16/read-sharepoint-list-through-web-servicejava-client-from-getlistitems-method/
http://davidsit.wordpress.com/2010/02/10/reading-a-sharepoint-list-with-java-tutorial/
Thanks,
Lhan Han
ListsSoapStub? How get it? I use wsdl2java ,and get ListsStub, but ListsStub has no these class :GetListItemsQuery ,GetListItemsResponseGetListItemsResult ....
-
Hi Marbury,
ListsSoapStub is your referenced Web Service class name, the above code is a sample code, if your referenced Web Service class name is other(based on your customize), you can use the custom class name. The point of your issue is how to use Java call Web Service, you can go to some professional java forums to get better support, for example:
https://forums.oracle.com/forums/forum.jspa?forumID=922
Thanks,
Lhan Han
- 已标记为答案 Lhan HanModerator 2012年4月6日 3:30
- 已编辑 Lhan HanModerator 2012年4月6日 6:34