API v1 Reference

Java – Login
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.common;

import com.z2systems.schemas.common.APILogin;
import com.z2systems.schemas.common.LoginRequest;
import com.z2systems.schemas.neonws.CommonService;
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 Login {

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


    @Test
    public void LoginTest() {


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

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

        Neonws ss = new Neonws(wsdlURL, SERVICE_NAME);
        CommonService port = ss.getCommonPort();

        System.out.println("Invoking login...");
        APILogin api = new APILogin();
        api.setApiKey("xxxxxx");
        api.setOrgId("test");

        com.z2systems.schemas.common.LoginRequest request = new LoginRequest();
        request.setLogin(api);
        com.z2systems.schemas.common.LoginResponse response = port.login(request);

        if(response != null){
            System.out.println(response.getOperationResult().toString());
            System.out.println(response.getUserSessionId());
        }


    }

}