Is the soap api still valid for Liferay 7.0

thumbnail
William Gosse, modified 7 Years ago. Liferay Master Posts: 533 Join Date: 7/4/10 Recent Posts

I was trying to use the 7.0 client zip downloadable from Sourceforge to write a client app but I'm having some issues. The Developer Network article for the soap api seems a little out of date for 7.0. Here the url:  https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/soap-web-services

The article references package that start with com.liferay.portal but the stuff I downloaded for 7 GA7 use packages that starts with com.liferay.client.soap.portal.

Any I tried using the sample code that's in the article with the necessary changes.  It seems to work some what but when I hit the following code:

// Get the ID of the remote user
userId = userSoap.getUserIdByScreenName(companySoap.getCompanyId(), remoteUser);
System.out.println("userId for user named " + remoteUser + " is " + userId);

I get the following exception:

2018-09-19 18:06:53.457 ERROR [http-nio-8080-exec-5][UserServiceSoap:826] com.liferay.portal.kernel.security.auth.PrincipalException$MustHavePermission: User 20119 must have VIEW permission for com.liferay.portal.kernel.model.User 20155
com.liferay.portal.kernel.security.auth.PrincipalException$MustHavePermission: User 20119 must have VIEW permission for com.liferay.portal.kernel.model.User 20155
        at com.liferay.portal.service.permission.UserPermissionImpl.check(UserPermissionImpl.java:69)
        at com.liferay.portal.kernel.service.permission.UserPermissionUtil.check(UserPermissionUtil.java:39)
 

I did have to open up the new Service Access Policy to allow all services to be accessible. Before that nothing seemed to work.  Also tried adding the following to my code as part of the authentication but no luck:

            // Locate the User service
            UserServiceSoapServiceLocator locatorUser = new UserServiceSoapServiceLocator();
            UserServiceSoap userSoap = locatorUser
                    .getPortal_UserService(_getURL(remoteUser, password, serviceUserName, true));
            ((Portal_UserServiceSoapBindingStub) userSoap).setUsername(remoteUser);
            ((Portal_UserServiceSoapBindingStub) userSoap).setPassword(password);

 

The exception seems to be saying that I'm not logged in as my admin user. Not sure what if anything I'm missing. I did this in 6.2 but its been a while. I've attached my source but its pretty much the same that's in the article.