Java – Link Individual to Organization


package com.z2systems.cxfclient.samples.account;

import com.z2systems.schemas.account.LinkIndividualToOrganizationRequest;
import com.z2systems.schemas.account.LinkIndividualToOrganizationResponse;
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 LinkIndividualToOrganizationAccount {

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

    @Test
    public void LinkTest() {


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

        LinkIndividualToOrganizationRequest request = new LinkIndividualToOrganizationRequest();


        request.setIndividualAccountId(5785L);
        request.setOrganizationAccountId(5786L);
        request.setIsPrimaryContact(Boolean.FALSE);
        request.setUserSessionId("T1357615747419");
        LinkIndividualToOrganizationResponse response = port.linkIndividualToOrganization(request);

        if (response != null) {

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

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

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

    }


}