Was this helpful?
Login and Logout
The following methods are available in the Entity API Service for starting and ending a user session.
login
logout
Note:  The following imports are required for all of the Java code examples on this page.
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.pervasive.datasolutions.api.service.EntityAPIServiceLocator;
import com.pervasive.datasolutions.api.service.EntityAPIService;
import com.pervasive.datasolutions.api.crud.CloudAPIException;
import com.pervasive.datasolutions.api.crud.InvalidSessionException;
import com.pervasive.datasolutions.api.crud.LoginResult;
import com.pervasive.datasolutions.api.entity.*;
import com.pervasive.datasolutions.api.crud.*;
login
Log in and start a session with the API. Verifies login credentials against the Actian DataCloud membership service.
Parameters
 
Name
Type
Description
Required?
username
String
User name of the user.
Yes.
password
String
Password of the user.
Yes.
Returns
 
Name
Type
Description
Login Result
LoginResult
The loginResult object wraps the visitorKey, the sessionId, a boolean indicating success or failure, and a message associated with the result.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:crud="http://datasolutions.pervasive.com/api/crud">
    <soapenv:Header/>
    <soapenv:Body>
        <crud:login>
            <username>testuser</username>
            <password>password</password>
        </crud:login>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:loginResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>
                <message>Login was successful.</message>
                <sessionId>125003101221.FFBE.5795.0733.4D8B.9D0D.AB5C</sessionId>
                <success>true</success>
                <visitorKey>10120813994482064946</visitorKey>
            </return>
        </ns2:loginResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final String username = "testuser";
final String password = "password";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
LoginResult result = stub.login(username, password);
logout
Log out and terminate the API session.
Parameters
 
Name
Type
Description
Required?
sessionId
String
ID of the current session.
Yes.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:crud="http://datasolutions.pervasive.com/api/crud">
    <soapenv:Header/>
    <soapenv:Body>
        <crud:logout>
            <sessionId>125003101221.FFBE.5795.0733.4D8B.9D0D.AB5C</sessionId>
        </crud:logout>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:logoutResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity"/>
   </S:Body>
</S:Envelope>
Java Code Sample
final String sessionId = "125003101227.4253.DC58.5A73.4AC1.AED2.5687";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
stub.logout(sessionId);
loginByExecution
This method is deprecated.
Parameters
 
Name
Type
Description
Required?
executionId
String
ID of the execution.
Yes.
Returns
 
Name
Type
Description
Login Result
LoginResult
The loginResult object wraps the visitorKey, the sessionId, a boolean indicating success or failure, and a message associated with the result. The visitorKey is null.
Example
SOAP Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:crud="http://datasolutions.pervasive.com/api/crud">
   <soapenv:Header/>
   <soapenv:Body>
      <crud:loginByExecution>
         <executionId>3dc247c2-1abb-47be-a698-788bf37339e4</executionId>
      </crud:loginByExecution>
   </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:loginResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
         <return>
            <message>Login was successful.</message>
            <sessionId>125003101221.FFBE.5795.0733.4D8B.9D0D.AB5C</sessionId>
            <success>true</success>
            <visitorKey>null</visitorKey>
         </return>
      </ns2:loginResponse>
   </S:Body>
</S:Envelope>
Java Code Sample
final String executionId = "125003110110.24AE.EB8A.BF6F.4F03.8CED.1ACE";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
LoginResult result = stub.loginByExecution(executionId);
Last modified date: 12/17/2021