cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Status 404 for AuthenticationService

ridgeway
Champ in-the-making
Champ in-the-making
Hi All,
I've been using Alfresco Web Services to access an Alfresco repository (Alfresco 3.4.d) for the last few months with very encouraging success; however, for the last week, I've been struggling with an issue that I can't find a solution for. I'm trying to change a user's password.

When I tried to call the ChangePassword method, there was no error, but the password wasn't changed. I then read that before the web script can change the password the AdministrationService endpoint must be set. Here's the C# code that I tried:

            AdministrationService AdminService = new AdministrationService();
            this.setEndpointAddress("http://192.168.20.10:8080/alfresco/api/AuthenticationService");
            AuthenticationService authenticationService = new AuthenticationService();
            authenticationService.startSession("admin", "password");
            this.setEndpointAddress("http://192.168.20.10:8080/alfresco/api/AdministrationService");
            AdminService.changePassword(usernam, oldPasswd, newPasswd);
            authenticationService.endSession("admin");

This code causes an exception on the "StartSession" line with the following error:

The request failed with HTTP status 404: /alfresco/api/AuthenticationService.

I searched and cannot find an AuthenticationService file or directory on my server.

I have two questions:

1. Has anyone been able to successfully change a user's password using web scripts?
2. Does anyone know where the AuthenicationService and AdministrationService files are?

Thanks in advance for any help.

Regards
3 REPLIES 3

mitpatoliya
Star Collaborator
Star Collaborator
Well I have not done any coding in C# for alfresco
but thing I want to point out is if you are setting endpoint this object is referring to what?

and where you are setting the end point you need to get the service from that context only.

In java we set endpoint in WebscriptSessionFactory and then get all the services from that factory only.
I think this is the problem over here as well you should not use

AuthenticationService authenticationService = new AuthenticationService();
You need to fetch that service from context where you had set the endpoint.

ridgeway
Champ in-the-making
Champ in-the-making
thank you, Mits for your reply. Your questions set me on the right track and as you suggested the endpoint wasn't needed.

The solution was very simple. Here it is if someone else is using C#:

this.getAdministrationService().changePassword(username, oldPassword, newPassword);
The part that I was missing was the call to getAdministrationService()

Regards

Well I have not done any coding in C# for alfresco
but thing I want to point out is if you are setting endpoint this object is referring to what?

and where you are setting the end point you need to get the service from that context only.

In java we set endpoint in WebscriptSessionFactory and then get all the services from that factory only.
I think this is the problem over here as well you should not use

AuthenticationService authenticationService = new AuthenticationService();
You need to fetch that service from context where you had set the endpoint.

mitpatoliya
Star Collaborator
Star Collaborator
Grt  😎  If it is solved please mark it as solved.