none
How to access SharePoint site through java RRS feed

  • Spørgsmål

  • 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 ....

    1. april 2012 09:45

Svar

Alle besvarelser

  • 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


    3. april 2012 09:22
    Redaktør
  • 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 ....

    6. april 2012 03:08
  • 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







    6. april 2012 03:22
    Redaktør
  • thank you very much
    6. april 2012 06:07