Getting all workgroups that use your signing service

Use getPublishers to get a list of publisher IDs that use your signing service.

Java
//add your client certificate
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
System.setProperty("javax.net.ssl.keyStore", "C:\\\\Program Files\\\\Java\\\\jdk1.8.0_25\\\\bin\\\\sas_keystore.p12");
System.setProperty("javax.net.ssl.keyStorePassword", "yourPassword");

//specify your partner code, username, and password
AuthToken authToken = new AuthToken();
authToken.setPartnerCode("partner code");
authToken.setUserName("user name");
authToken.setPassword("password");

PublishersRequestType getPublishersInfo = new PublishersRequestType();
getPublishersInfo.setAuthToken(authToken);

//specify the date range (yyyy-mm-ddThh:mm:ss)
//(ISO 8601 format).
Calendar fromDate = Calendar.getInstance();
fromDate.set(2015, Calendar.JANUARY, 1);
Calendar toDate = Calendar.getInstance();

DateRange creationDate = new DateRange();
creationDate.setFromDate(fromDate);
creationDate.setToDate(toDate);

getPublishersInfo.setCreationDate(creationDate);
getPublishersInfo.setStatus("ACTIVE");

PublishersResponseType response;
try {
    SigningProxy request = new SigningProxy();
    response = request.getPublishers(getPublishersInfo);
    
    //get the result code
    System.out.println("Result code: \\t" + response.getResult().getResultCode());
    
    //if the request is successful with or without warnings
    if (response.getResult().getResultCode() >= 0) {
        try {
            //list errors, if present
            Error[] error = response.getResult().getErrors();
            for (Error err : error) {
                if (!err.getErrorMessage().isEmpty()) {
                    System.err.println("Warning: " + err.getErrorMessage() + " Field: " + err.getErrorField());
                }
            }
        }
        catch (Exception e) {}
        
        //Print success message, publisherID, partnerOrderID, orderID
        System.out.println("Success!");
        System.out.println("Publisher IDs");
        System.out.println("-------------------");                
        int[] ids = response.getPublisherIDs();
        if(ids!=null){
            for (int i = 0; i < ids.length; i++) {
                System.out.println(ids[i]);
            }                    
        }                
        
    } else {
        //if the request failed, list any errors
        try {
            //list errors, if present
            Error[] error = response.getResult().getErrors();
            for (Error err : error) {
                if (!err.getErrorMessage().isEmpty()) {
                    System.err.println("Warning: " + err.getErrorMessage() + " Field: " + err.getErrorField());
                }
            }
        }
        catch (Exception e) {
            System.out.println("Error while reading request details");
        }
    }
}
catch (Exception e) {}
C#
//create the service object
SigningService signingService = new SigningService();

//add client cert for two-factor-authentication
string clientCertPath = "C:\\\\Users\\\\Administrator\\\\Desktop\\\\sas_pfx.pfx";
string clientCertPassword = "yourPassword";
X509Certificate2 clientCert = new X509Certificate2(clientCertPath, clientCertPassword);
signingService.ClientCertificates.Add(clientCert);

//add your username, password, and partnercode
AuthToken authToken = new AuthToken();
authToken.partnerCode = "partner code";
authToken.userName = "username";
authToken.password = "password";
PublishersRequestType getPublishersInfo = new PublishersRequestType();
getPublishersInfo.authToken = authToken;

//specify the date range for workgroups (yyyy-mm-ddThh:mm:ss)
DateTime fromDate = DateTime.Parse("2008-09-15T09:30:41.7752486-07:00");
DateTime toDate = DateTime.Now;
DateRange creationDate = new DateRange();
creationDate.fromDate = fromDate;
creationDate.toDate = toDate;
getPublishersInfo.creationDate = creationDate;

//return active or inactive workgroups
getPublishersInfo.status = "ACTIVE";

PublishersResponseType response;

try
{
    response = signingService.getPublishers(getPublishersInfo);

    Console.WriteLine("Result code: " + response.result.resultCode);

    if (response.result.resultCode >= 0)
    {
        try
        {
            Error[] errors = response.result.errors;
            foreach (Error error in errors)
            {
                if (error.errorMessage.Length > 0)
                {
                    Console.WriteLine("Warning: " + error.errorMessage + " Field: " + error.errorField);
                }
            }
        }
        catch (Exception e) { }

        //Prints the IDs for workgroups in your account
        Console.WriteLine("Success!");
        Console.WriteLine("Publisher IDs");
        Console.WriteLine("-------------------");
        int[] ids = response.publisherIDs;
        if (ids != null)
        {
            for (int i = 0; i < ids.Length; i++)
            {
                Console.WriteLine(ids[i]);
            }
        }
    }
    else
    {
        try
        {
            //list errors, if present
            Error[] errors = response.result.errors;
            foreach (Error error in errors)
            {
                if (error.errorMessage.Length > 0)
                {
                    Console.WriteLine("Warning: " + error.errorMessage + " Field: " + error.errorField);
                }
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Error while reading request details: " + e.InnerException.Message);
        }
    }
}
catch (Exception e) { }

We use cookies to ensure that we give you the best experience on our website. By using this site, you agree to the Terms of Service.