eDocBuilder Integration: PHP Example

Unfortunately, Aleyant is not able to help you directly debug any programming code. If you encounter any issues in developing an integration to eDocBuilder, please send SOAP XML captures rather than code so that we may assist you. We are, however, providing this sample PHP code for your reference. This code is provided "as is" with no guarantees.

 

<?php 
//This sample uses NUSOAP
require_once('nusoap/nusoap.php');

$result = array();

try {
    $buildDoc = new nusoap_client("https://engine.edocbuilder.com/services/builddoc.asmx?WSDL", true); 

    //1. Start Session
    $docSession = $buildDoc->call('startDocSession', array('docCode' => 'DOC_CODE',  'docPwd' => 'DOC_PWD', 'remote_tag' => 'ANY_HELPFUL_TAG'));
    $currentSession = $buildDoc->call('getCurrentSession', array('docSessionID' => $docSession['startDocSessionNoPwdResult']['docSession']));

    //2. Decide element Value (valid for text fields only)
    $elementValue = 'From PHP through API';

    //3. Update field value
    $pageCount = $buildDoc->call('updateCurrentSession', array(
                                                            'docSessionID' => $docSession['startDocSessionNoPwdResult']['docSession'], 
                                                            'userValues' => array(
                                                                'userEntries' => array(
                                                                    'elementName' => 'field', 
                                                                    'elementValue' => $elementValue))));

    //4. Approve Session
    $approvalResult = $buildDoc->call('approveDocSession', array('docSessionID' => $docSession['startDocSessionNoPwdResult']['docSession']));
} catch (Exception $e) {
    //  Capture SOAP exception
    $result['startDocSession'] = $e;  
}

?>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
        <title>eDoc API Communication</title>
    </head>
    <body>
        <h2>startDocSession</h2>
        <pre><?php echo htmlspecialchars(var_dump($docSession), ENT_QUOTES); ?></pre>
        <h2>getCurrentSession</h2>
        <pre><?php echo htmlspecialchars(var_dump($currentSession), ENT_QUOTES); ?></pre>
        <h2>updateCurrentSession</h2>
        <pre><?php echo htmlspecialchars(var_dump($pageCount), ENT_QUOTES); ?></pre>
        <h2>approveDocSession</h2>
        <pre><?php echo htmlspecialchars(var_dump($approvalResult), ENT_QUOTES); ?></pre>
    </body>
</html>