Java – List Organization Contacts


package com.z2systems.cxfclient.samples.account;

import com.z2systems.schemas.account.ListOrganizationContactsRequest;
import com.z2systems.schemas.account.ListOrganizationContactsResponse;
import com.z2systems.schemas.common.OperationResult;
import com.z2systems.schemas.neonws.AccountService;
import com.z2systems.schemas.neonws.Neonws;
import org.junit.Test;

import javax.xml.namespace.QName;
import java.net.MalformedURLException;
import java.net.URL;

public class ListOrganizationContacts {

    private static final QName SERVICE_NAME = new QName("http://www.z2systems.com/schemas/neonws/", "Neonws");


    @Test
    public void listOrganizationContactsTest() {

        URL wsdlURL = null;
        try {
            wsdlURL = new URL("https://api.neoncrm.com/neonws/services/AccountService?wsdl");

        } catch (MalformedURLException e) {
            e.printStackTrace();
        }

        Neonws ss = new Neonws(wsdlURL, SERVICE_NAME);
        AccountService port = ss.getAccountPort();

        ListOrganizationContactsRequest request = new ListOrganizationContactsRequest();

        request.setOrganizationAccountId(5786L);
        request.setUserSessionId("T1357615747419");
        ListOrganizationContactsResponse response = port.listOrganizationContacts(request);

        if (response != null) {

            System.out.println(response.getOperationResult().toString());

            if (OperationResult.SUCCESS.equals(response.getOperationResult())) {

                System.out.println(response.getOrganizationContacts());
            } else {
                System.out.println(response.getErrors());
            }
        }
    }
}