Was this helpful?
Credential
The following methods are available for manipulating the credential entity with the Entity API Service.
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.entity.*;
import com.pervasive.datasolutions.api.crud.*;
Tip...  Use the login method to start a session and obtain the sessionId parameter. See Login and Logout.
listCredentials
List the credentials associated with the current user.
Parameters
 
Name
Type
Description
Required?
firstResults
Integer
0-indexed ordinal of the first record to return.
No.
maxResult
Integer
Maximum number of records to return.
No.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Credential (0..*)
List<Credential>
List of credentials.
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:listCredentials>
            <firstResult>0</firstResult>
            <maxResults>100</maxResults>
            <sessionId>125003101222.7BEA.3DC4.0FDA.41CC.93F0.B130</sessionId>
        </crud:listCredentials>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:listCredentialsResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return id="1675857">
                <owner id="171">testuser</owner>
                <expiration>2010-12-22T13:43:32.001-05:00</expiration>
                <parameters>
                    <parameterbkey="visitorKey">1012F496D9A760394049</parameter>
                    <parameterbkey="sessionId">125003101221.BF38.43E4.CD9B.4A4D.9004.1748</parameter>
                </parameters>
                <type>pervasiveSession</type>
            </return>
            <return id="1675885">
                <owner id="171">testuser</owner>
                <expiration>2010-12-22T08:30:21.861-05:00</expiration>
                <parameters>
                    <parameterbkey="visitorKey">10126E2C3AE403A3452B</parameter>
                    <parameterbkey="sessionId">125003101221.8504.7395.A215.4D52.B497.465C</parameter>
                </parameters>
                <type>pervasiveSession</type>
            </return>
            <return id="1676346">
                <owner id="171">testuser</owner>
                <expiration>2010-12-22T12:52:10.265-05:00</expiration>
                <parameters>
                    <parameterbkey="sessionId">125003101222.0983.1D44.8AB4.447E.ADD9.9FDE</parameter>
                    <parameterbkey="visitorKey">1012ADCEC4C7289D447D</parameter>
                </parameters>
                <type>pervasiveSession</type>
            </return>
        </ns2:listCredentialsResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final int firstResult = 0;
final int maxResults = 100;
final String sessionId = "125003101227.4253.DC58.5A73.4AC1.AED2.5687";
import java.util.List;
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
List <Credential> credentials=stub.listCredentials(firstResult, maxResults, sessionId);
listCredentialsByGroup
List the credentials associated with the specified group.
Parameters
 
Name
Type
Description
Required?
firstResults
Integer
0-indexed ordinal of the first record to return.
No.
maxResult
Integer
Maximum number of records to return.
No.
id
Long
ID of the group.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Credential (0..*)
List<Credential>
List of credentials.
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:listCredentialsByGroup>
            <firstResult>0</firstResult>
            <maxResults>10</maxResults>
            <id>150</id>
            <sessionId>82f379ab-44e4-4d04-b0da-7c11404cfd99</sessionId>
        </crud:listCredentialsByGroup>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:listCredentialsByGroupResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity"/>
    </S:Body>
</S:Envelope>
Java Code Sample
final int firstResult = 0;
final int maxResults = 100;
final Long id = 2;
final String sessionId = "125003101227.4253.DC58.5A73.4AC1.AED2.5687";
import java.util.List;
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
List <Credential> credentials=stub.listCredentialsByGroup(firstResult, maxResults, id, sessionId);
findCredential
Returns a specified credential (must be associated with the current user).
Parameters
 
Name
Type
Description
id
Long
ID of the credential to return.
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Credential
Credential
Credential corresponding to the ID.
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:findCredential>
            <id>1675857</id>
            <sessionId>125003101222.7BEA.3DC4.0FDA.41CC.93F0.B130</sessionId>
        </crud:findCredential>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:findCredentialResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return id="1675857">
                <owner id="171">testuser</owner>
                <expiration>2010-12-22T13:43:32.001-05:00</expiration>
                <parameters>
                    <parameter key="visitorKey">1012F496D9A760394049</parameter>
                    <parameter key="sessionId">125003101221.BF38.43E4.CD9B.4A4D.9004.1748</parameter>
                </parameters>
                <type>pervasiveSession</type>
            </return>
        </ns2:findCredentialResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1675857;
final String sessionId = "125003101222.7BEA.3DC4.0FDA.41CC.93F0.B130";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
Credential credential=stub.findCredential(id, sessionId);
createCredential
Creates a new credential object associated with the current user.
Parameters
 
Name
Type
Description
Required?
credential
Credential
Credential to create.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Credential
Credential
Credential created.
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:createCredential>
            <credential id="2958500">
                <owner id="171">testuser</owner>
                <account>100</account>
                <expiration>2012-11-24T00:00:00-04:00</expiration>
                <group>150</group>
                <parameters>
                    <!--Zero or more repetitions:-->
                    <parameter key="myCredentialParamKey" secure="no">myCredentialParamVelua</parameter>
                </parameters>
                <type>testing</type>
            </credential>
            <sessionId>82f379ab-44e4-4d04-b0da-7c11404cfd99</sessionId>
        </crud:createCredential>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:createCredentialResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return id="2992124">
                <owner id="171">testuser</owner>
                <account>1</account>
                <expiration>2012-11-24T04:00:00Z</expiration>
                <parameters>
                    <parameter key="myCredentialParamKey">myCredentialParamVelua</parameter>
                </parameters>
                <type>testing</type>
            </return>
        </ns2:createCredentialResponse>
    </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();
Credential newCredential= new Credential();
Calendar expdate=Calendar.getInstance();
newCredential.setGroup(2);
newCredential.setExpiration(expdate);
newCredential.setId(2991618);
UserInfo uf=new UserInfo();
uf.setId(172);
uf.set_value("testuser");
newCredential.setOwner(uf);
CredentialParameter[] cparameter=new CredentialParameter[5];
cparameter[0].set_value("CrednetialKeyValue");
cparameter[0].setKey("CrednetialKey");
cparameter[0].setSecure(true);
newCredential.setParameters(cparameter);
newCredential.setType("executionSession");
Credential c = stub.createCredential(newCredential, sessionId);
editCredential
Edit the specified credential. Must be associated with the current user.
Parameters
 
Name
Type
Description
Required?
credential
Credential
New value of the credential to be edited.
Yes.
sessionId
String
ID of the current user 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:editCredential>
            <credential id="2992124">
                <owner id="171">testuser</owner>
                <account>100</account>
                <expiration>2011-11-02T00:00:00-04:00</expiration>
                <group>150</group>
                <parameters>
                    <!--Zero or more repetitions:-->
                    <parameter key="testKey" secure="no">testValue</parameter>
                </parameters>
                <type>development</type>
            </credential>
            <sessionId>82f379ab-44e4-4d04-b0da-7c11404cfd99</sessionId>
        </crud:editCredential>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:editCredentialResponse 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();
import java.text.SimpleDateFormat;
import java.util.Date;
Credential editedCred = new Credential();
Calendar expdate=Calendar.getInstance();
editedCred.setExpiration(expdate);
editedCred.setId(2991618);
UserInfo uf=new UserInfo();
uf.setId(172);
uf.set_value("testuser");
editedCred.setOwner(uf);
editedCred.setGroup(2);
CredentialParameter[] cparameter=new CredentialParameter[5];
cparameter[0].set_value("CrednetialKeyValue");
cparameter[0].setKey("CrednetialKey");
cparameter[0].setSecure(true);
editedCred.setParameters(cparameter);
editedCred.setType("executionSession");
stub.editCredential(editedCred, sessionId);
deleteCredential
Delete a specified credential.
Parameters
 
Name
Type
Description
Required?
id
Long
ID of the credential to delete.
Yes.
sessionId
String
ID of the current user 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:deleteCredential>
            <id>1690765</id>
            <sessionId>125003101226.E179.E9D3.3DA5.4598.A2DE.C3A7</sessionId>
        </crud:deleteCredential>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:deleteCredentialResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity"/>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1690765;
final String sessionID = "125003101226.E179.E9D3.3DA5.4598.A2DE.C3A7";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
stub.deleteCredential(id, sessionId);
getCredentialCount
Count the credentials associated with the current user.
Parameters
 
Name
Type
Description
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Credential Count
Long
Count of credentials.
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:getCredentialCount>
            <sessionId>125003101222.7BEA.3DC4.0FDA.41CC.93F0.B130</sessionId>
        </crud:getCredentialCount>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:getCredentialCountResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>12</return>
        </ns2:getCredentialCountResponse>
    </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();
Long count = stub.getCredentialCount(sessionId);
getCredentialParameter
Return the value of a parameter associated with a specified credential.
Parameters
 
Name
Type
Description
Required?
Id
Long
ID of the credential.
Yes.
key
String
Key of the parameter to return.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Parameter Value
String
Value of the parameter associated with the specified key.
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:getCredentialParameter>
            <id>1688381</id>
            <key>parameterkey</key>
            <sessionId>125003101226.E179.E9D3.3DA5.4598.A2DE.C3A7</sessionId>
        </crud:getCredentialParameter>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:getCredentialParameterResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>parametervalue</return>
        </ns2:getCredentialParameterResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1679455;
final String key = "parameterKey";
final String sessionId = "125003101227.4253.DC58.5A73.4AC1.AED2.5687";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
String parameterValue = stub.getCredentialParameter(id, key, sessionId);
putCredentialParameter
Store a key/value pair associated with a specified credential.
Parameters
 
Name
Type
Description
Required?
id
Long
ID of the credential.
Yes.
key
String
Key of the parameter.
Yes.
value
String
Value of the parameter.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
Parameter Value
String
Old value of the parameter (or null if it is a new parameter).
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:putCredentialParameter>
            <id>1679455</id>
            <key>testcretentialparameter2</key>
            <value>testvalue2</value>
            <sessionId>125003101223.B2F3.63B7.6FA8.469B.9FDE.30AA</sessionId>
        </crud:putCredentialParameter>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:putCredentialParameterResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity"/>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1679455;
final String key = "parameterKey";
final String value = "parameterValue";
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
com.pervasive.datasolutions.api.crud.EntityAPIService stub = service.getEntityAPIPort();
String parameterValue = stub.putCredentialParameter(id, key, value, sessionId);
removeCredentialParameter
Remove a parameter from a specified credential.
Parameters
 
Name
Type
Description
id
Long
ID of the credential from which to remove a parameter.
key
String
Key of the parameter to remove.
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Parameter Value
String
Old value of the parameter.
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:removeCredentialParameter>
            <id>1679455</id>
            <key>testcretentialparameter</key>
            <sessionId>125003101223.B2F3.63B7.6FA8.469B.9FDE.30AA</sessionId>
        </crud:removeCredentialParameter>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:removeCredentialParameterResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>testcretentialparametervalue</return>
        </ns2:removeCredentialParameterResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1679455;
final String key = "parameterKey";
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
String parameterValue = stub.removeCredentialParameter(id, key, sessionId);
listCredentialFiles
List the files associated with a specified credential.
Parameters
 
Name
Type
Description
Required?
Id
Long
ID of the credential.
Yes.
sessionId
String
ID of the current user session.
Yes.
Returns
 
Name
Type
Description
File Names
List<java.lang.String>
List of files associated with the credential.
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:listCredentialFiles>
            <credentialId>1679239</credentialId>
            <sessionId>125003101223.6634.326B.C412.41CD.8643.4190</sessionId>
        </crud:listCredentialFiles>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:listCredentialFilesResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>credential file1</return>
            <return>credential file2</return>
        </ns2:listCredentialFilesResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long id = 1679455;
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
import java.util.List;
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
List <String> listfiles=stub.listCredentialFiles(id, sessionId);
getCredentialFile
Download a file associated with a specified credential.
Parameters
 
Name
Type
Description
credentialId
Long
ID of the credential.
filename
String
Name of the file to download.
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Credential File
DataHandler
DataHandler wrapping the file data.
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:getCredentialFile>
            <credentialId>1679239</credentialId>
            <filename>credential file</filename>
            <sessionId>125003101223.6634.326B.C412.41CD.8643.4190</sessionId>
        </crud:getCredentialFile>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:getCredentialFileResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
         <return>cid1094948532470</return>
      </ns2:getCredentialFileResponse>
   </S:Body>
</S:Envelope>
Java Code Sample
final Long credentialId = 1679455;
final String filename = "credential file";
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
import javax.activation.DataHandler;
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
DataHandler fileHandlr = null;
fileHandlr=stub.getCredentialFile(credentialId, filename, sessionId);
putCredentialFile
Upload a file associated with a specified credential.
Parameters
 
Name
Type
Description
credentialId
Long
ID of the credential.
filename
String
Name of the file to upload.
data
DataHandler
DataHandler wrapping the file data.
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Number of Bytes
Long
Number of bytes written.
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:putCredentialFile>
            <credentialId>1679239</credentialId>
            <filename>credential file</filename>
            <data>cid:1094948532470</data>
            <sessionID>125003101223.6634.326B.C412.41CD.8643.4190</sessionID>
        </crud:putCredentialFile>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:putCredentialFileResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>12</return>
        </ns2:putCredentialFileResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long credentialId = 1679455;
final String filename = "credential file";
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
import javax.activation.DataHandler;
import javax.activation.DataSource;
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
Long size = 0L;
InputStream in = new FileInputStream("InputStreamToFile.txt");
DataSource dataSource = new DataSource() {
    @Override
    public InputStream getInputStream() throws IOException {
        return in;
    }
    @Override
    public OutputStream getOutputStream() throws IOException {
        return null;
    }
    @Override
    public String getContentType() {
        return "application/octet-stream";
    }
    @Override
    public String getName() {
        return filename;
    }
};
DataHandler dataHandler = new DataHandler(dataSource);
size = stub.putCredentialFile(credentialId, filename, dataHandler, sessionId);
deleteCredentialFile
Delete a file associated with a specified credential.
Parameters
 
Name
Type
Description
credentialId
Long
ID of the credential.
filename
String
Name of the file to delete.
sessionId
String
ID of the current user session.
Returns
 
Name
Type
Description
Number of Bytes
Long
Number of bytes deleted.
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:deleteCredentialFile>
            <credentialId>1688381</credentialId>
            <filename>credentialfile</filename>
            <sessionID>125003101226.E179.E9D3.3DA5.4598.A2DE.C3A7</sessionID>
        </crud:deleteCredentialFile>
    </soapenv:Body>
</soapenv:Envelope>
SOAP Response
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:deleteCredentialFileResponse xmlns:ns2="http://datasolutions.pervasive.com/api/crud" xmlns:ns3="http://datasolutions.pervasive.com/api/entity">
            <return>10</return>
        </ns2:deleteCredentialFileResponse>
    </S:Body>
</S:Envelope>
Java Code Sample
final Long credentialId = 1679455;
final String filename = "credential file";
final String sessionId = "125003101223.6634.326B.C412.41CD.8643.4190";
EntityAPIServiceLocator service = new EntityAPIServiceLocator();
EntityAPIService stub = service.getEntityAPIPort();
Long bytesdeleted = stub.deleteCredentialFile(credentialId, filename, sessionId);
Last modified date: 12/17/2021