amusarra
3/28/2014 - 9:59 AM

Listato 4 Esempio di accesso al servizio SOAP tramite il client generato dall’SDK.

Listato 4 Esempio di accesso al servizio SOAP tramite il client generato dall’SDK.

public class TestGetUsersCompanyByTagNameService {

	static final String LIFERAY_USER_NAME = (System.getProperty("username") != null) ? System
			.getProperty("username") : "test@liferay.com";
	static final String LIFERAY_USER_PASSWORD = (System.getProperty("password") != null) ? System
			.getProperty("username") : "test";

	static final String USER_SERVICE = "Portal_UserService";

	/**
	 * 
	 */
	public TestGetUsersCompanyByTagNameService() {
	}
	
	public static void main(String[] args) throws Exception, SystemException {
		CustomUsersServiceSoapServiceLocator locator = new CustomUsersServiceSoapServiceLocator();
		CustomUsersServiceSoap customUsersService = locator
				.getPlugin_shirus_labs_liferay_ws_example_CustomUsersService();

		((Plugin_shirus_labs_liferay_ws_example_CustomUsersServiceSoapBindingStub) customUsersService)
				.setUsername(LIFERAY_USER_NAME);
		((Plugin_shirus_labs_liferay_ws_example_CustomUsersServiceSoapBindingStub) customUsersService)
				.setPassword(LIFERAY_USER_PASSWORD);

		UserSoap[] listUsers = customUsersService.getUsersCompanyByTagName(
				10157l, "crm", 0, 0, 10);

		for (UserSoap userSoap : listUsers) {
			System.out.println("User ScreeName : " + userSoap.getScreenName());
		}
	}
}