views:

35

answers:

0

Hi, I'm trying to run the following in the main of my java class. The code uses the stub to first authenticate and then bring back the collection of lists in a microsoft sharepoint site.

The code is as follows:

    ListsStub stub = new ListsStub();

        HttpTransportProperties.Authenticator auth = new HttpT

ransportProperties.Authenticator();

                auth.setUsername(username);
                auth.setPassword(pw);
                auth.setDomain(domain);
                auth.setHost(host);

                List schemes = new ArrayList(1);
                schemes.add(AuthPolicy.NTLM);
                 auth.setAuthSchemes (schemes);


                stub._getServiceClient().getOptions().setProperty(
                org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
                auth);
                stub._getServiceClient().getOptions().setProperty (HTTPConstants.HTTP_PROTOCOL_VERSION,
                        HTTPConstants.HEADER_PROTOCOL_10);
                //stub._getServiceClient().getOptions().setProperty (HTTPConstants.PROXY, proxy);


                String liste = "sharepointlist";
                String document2ID;

                    ListsStub.GetListCollection req = new ListsStub.GetListCollection();

                    ListsStub.GetListCollectionResponse res = null;
                    try {
                        res = stub.getListCollection(req);
                    } catch (RemoteException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

I get a 401 that indicates my login is incorrect:

org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.axis2userguide.ListsStub.getListCollection(ListsStub.java:1936) at gov.nasa.jpl.spconnect.MainKickOff.main(MainKickOff.java:73)

Does anyone know why I might be getting this?