API v1 Reference

Java – List Accounts by Default
Not Supported

Code Not Supported

Unfortunately, due to changing priorities, we are no longer able to support the code provided here. However, we are leaving these pages public for historical reference and the benefit of our developer community.


package com.z2systems.cxfclient.samples.account;

import com.z2systems.schemas.account.*;
import com.z2systems.schemas.common.OperationResult;
import com.z2systems.schemas.common.Page;
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 ListAccountsByDefault {

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

    @Test
    public void listAccountByDefaultTest() {

        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();

        ListAccountsByDefaultRequest request = new ListAccountsByDefaultRequest();

        //construct list account search criteria
        AccountSearchCriteria searchCriteria = new AccountSearchCriteria();
        searchCriteria.setFirstName("John");

        //construct page object
        Page page = new Page();
        page.setPageSize(50L);
        page.setCurrentPage(1L);

        request.setPage(page);
        request.setAccountSearchCriteria(searchCriteria);
        request.setUserSessionId("T1357615747419");
        ListAccountsByDefaultResponse response = port.listAccountsByDefault(request);

        if (response != null) {

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

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

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

    }

}