login()

Authenticates the user and starts a client session.

Syntax

            LoginResult loginResults = stub.login(LoginParams loginParameters); 

          

Usage

Use the login() command to authenticate the user and start a client session. The call returns a unique client session identifier [sessionId]. This client session ID can be used to make subsequent calls to the SOAP API until the session expires or is ended for the authenticated user by a logout() call. See Using SessionHeader for Client Session ID Authentication.

Arguments

Name

Type

Description

loginParameters

LoginParams

A LoginParams object.

Response

LoginResult — A LoginResult object.

Sample Code — C#

            // Create service stub
OAirServiceHandlerService _svc = new OAirServiceHandlerService();

// create LoginParam object
LoginParams loginParams = new LoginParams();
loginParams.api_namespace = "<Your_API_Namespace>";
loginParams.api_key = "<Your_API_Key>";
loginParams.company = "<Your_Company_ID>";
loginParams.user = "<Your_User_ID>";
loginParams.password = "<Your_Password>";
loginParams.client = "<Your_client_application>";
loginParams.version = "1.0";
LoginResult loginResult = _svc.login(loginParams);

// Create a new session header object
// Add the session ID returned from the login
_svc.SessionHeaderValue = new SessionHeader();
_svc.SessionHeaderValue.sessionId = loginResult.sessionId; 

          

Sample Code — Java

            // create our login parameters
LoginParams lp = new LoginParams();
lp.setApi_namespace("<Your_API_Namespace>");
lp.setApi_key("<Your_API_Key>");
lp.setCompany("<Your_Company_ID>");
lp.setUser("<Your_User_ID>");
lp.setPassword("<Your_Password>");
lp.setClient("<Your_client_application>");
lp.setVersion("1.0");

// set the service URL from our arguments
OAirServiceHandlerServiceLocator locator = new OAirServiceHandlerServiceLocator();
locator.setOAirServiceAddress("https://company-id.app.openair.com/soap");

// now login
OAirServiceSoapBindingStub binding =
(OAirServiceSoapBindingStub)locator.getOAirService();
LoginResult loginResult = binding.login(lp);

// Create a new session header object
// Add the session ID returned from the login
SOAPHeaderElement header = new SOAPHeaderElement("https://company-id.app.openair.com/OAirService", "SessionHeader");
SOAPElement node = header.addChildElement("sessionId");
node.addTextNode(loginResult.getSessionId());
binding.setHeader(header);