2

I am getting following error while using the SharePoint web service:

com.sun.xml.internal.ws.client.ClientTransportException: The server
sent HTTP status code 403: Forbidden at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(Unknown Source) at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(Unknown Source) at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source) at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source) at
com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source) at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown
Source) at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown
Source) at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown
Source) at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown
Source) at com.sun.xml.internal.ws.client.Stub.process(Unknown
Source) at
com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown
Source) at
com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown
Source) at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source) at com.sun.proxy.$Proxy34.getListItems(Unknown Source) at
com.jw.sharepoint.examples.SharePointListExample.querySharePointFolder(SharePointListExample.java:67) at
com.jw.sharepoint.examples.SharePointListExample.main(SharePointListExample.java:50)

I am trying to access SharePoint 2010 web service using the following code:

    public void querySharePointFolder(ListsSoap ls) throws Exception {  
        try
        {
            disableCertificateValidation();
        GetListItems.ViewFields viewFields = null;
        GetListItems.QueryOptions msQueryOptions = new GetListItems.QueryOptions();
        GetListItems.Query msQuery = new GetListItems.Query();
        msQuery.getContent().add(createSharePointCAMLNode(query));
        msQueryOptions.getContent().add(createSharePointCAMLNode(this.queryOptions));
        GetListItemsResponse.GetListItemsResult result = ls.getListItems(
                properties.getProperty("folder"), "", msQuery, viewFields, "",
                msQueryOptions, "");
        writeResult(result.getContent().get(0), System.out);

        Element element = (Element)result.getContent().get(0);
        NodeList nl = element.getElementsByTagName("z:row");
        for(int i = 0; i < nl.getLength(); i++){
            Node node = nl.item(i);
            logger.debug("ID: " + node.getAttributes().getNamedItem("ows_ID").getNodeValue());
            logger.debug("FileRef: " + node.getAttributes().getNamedItem("ows_FileRef").getNodeValue());
        }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

But its showing the error at following line:

GetListItemsResponse.GetListItemsResult result = ls.getListItems(
                properties.getProperty("folder"), "", msQuery, viewFields, "",
                msQueryOptions, "");

Can you please help me out over this as after using different different approaches i am still getting the same issue 403: Forbidden.

I am using the same credential here through which i had created the folder over SharePoint. Do I need any other privileges for that credential to get the access.

gkbstar
  • 615
  • 1
  • 6
  • 16

0 Answers0