@@ -0,0 +1,2670 @@
+package com.contactlab.api.samples.managingsubscribers;%0A%0Aimport com.contactlab.api.ws.ClabService;%0Aimport com.contactlab.api.ws.ClabService_Service;%0Aimport com.contactlab.api.ws.domain.AuthToken;%0Aimport com.contactlab.api.ws.domain.Subscriber;%0Aimport com.contactlab.api.ws.domain.SubscriberAttribute;%0A%0Apublic class AddSubscriber %7B%0A%0A    // REQUIRED%0A%0A    private final String apiKey = %22%3C%3C api key %3E%3E%22;%0A    private final String userKey = %22%3C%3C user key %3E%3E%22;%0A    private final int subscriberSourceId = 0;%0A    private String attributeKey = %22%3C%3C key %3E%3E%22; // Subscriber source's field name%0A    private String attributeValue = %22%3C%3C value %3E%3E%22; // Subscriber source's field value%0A%0A    // Other variables%0A%0A    private ClabService clabService;%0A    private AuthToken authToken;%0A    private Subscriber subscriberToBeAdded;%0A%0A%0A    public static void main(String%5B%5D args) %7B%0A        new AddSubscriber();%0A    %7D%0A%0A    public AddSubscriber() %7B%0A        // init variables%0A        startVariables();%0A%0A        // adds a subscriber to a subscriber source%0A        Subscriber createdSubscriber = addSubscriber(subscriberToBeAdded);%0A%0A        if (createdSubscriber != null)%0A        %7B%0A            System.out.println(%22Subscriber %5B%22 + createdSubscriber.getIdentifier()%0A                    + %22%5D was successfully added to userDB %5B%22 + subscriberSourceId + %22%5D%22);%0A        %7D%0A%0A        // invalidateToken%0A        clabService.invalidateToken(authToken);%0A%0A    %7D%0A%0A    private void startVariables() %7B%0A%0A        this.clabService = new ClabService_Service().getClabServicePort();%0A%0A        // borrow token%0A        this.authToken = clabService.borrowToken(apiKey, userKey);%0A%0A        /* Initialize a new Subscriber */%0A        this.subscriberToBeAdded = new Subscriber();%0A%0A%09%09/* Add the EMAIL field to Subscriber's attributes. */%0A%09%09/*%0A%09%09 * Only EMAIL field is mandatory, but you can set an attribute for each%0A%09%09 * field in the specified subscriber source.%0A%09%09 */%0A        SubscriberAttribute subscriberAttributeEmail = new SubscriberAttribute();%0A        subscriberAttributeEmail.setKey(attributeKey);%0A        subscriberAttributeEmail.setValue(attributeValue);%0A        subscriberToBeAdded.getAttributes().add(subscriberAttributeEmail);%0A    %7D%0A%0A    private Subscriber addSubscriber(Subscriber subscriber)%0A    %7B%0A        Subscriber addedSubscriber = null;%0A        try %7B%0A            addedSubscriber = this.clabService.addSubscriber(authToken, subscriberSourceId, subscriber);%0A        %7D catch (Exception e) %7B%0A            System.err.println(%22Error while adding the Subscriber %5B%22%0A                    + (subscriber.getAttributes().get(0)).getValue() + %22%5D%22);%0A            e.printStackTrace();%0A        %7D%0A%0A        return addedSubscriber;%0A    %7D%0A%7D%0A

Add addSubscriber sample.