Example 2: Retrieving the list of profiles for a specified account
(Return to main article: Samples for Java (SOAP) v1)
1. Define login and account information:
final int accountId = 1; private static final String login = "URCHIN_LOGIN"; private static final String password = "URCHIN_PASSWORD";
2. Define a service connection for the AdminService API:
AdminserviceStub adminStub = new AdminserviceStub();
3. Define a request for the getProfileList method in the AdminService:
AdminserviceStub.GetProfileList profileReq = new AdminserviceStub.GetProfileList();
4. Define the parameters:
profileReq.setLogin(login); profileReq.setPassword(password); profileReq.setAccountId(accountId);
5. Get the list of profiles for the account:
AdminserviceStub.GetProfileListResponse profileRsp = adminStub.getProfileList(profileReq);
6. Parse and display the list of profiles:
for (AdminserviceStub.GetProfileListResponseSequence profile : responseSequence){ System.out.print("profile id: \"" + profile.localProfile.getProfileId() + "\", "); System.out.print("profile name: \"" + profile.localProfile.getProfileName() + "\"; "); System.out.print("account id: \"" + profile.localProfile.getAccountId() + "\", "); System.out.println("account name: \"" + profile.localProfile.getAccountName() + "\"."); }
For the complete sample code, see the implementation of GetProfileList() in the AdminService.java file.
(Return to main article: Samples for Java (SOAP) v1)