Version 1 (modified by TS, 12 years ago)

--

Przewodnik wdrożeniowca > Dodaj załącznik do dokumentu

Definicja parametrów:

<?php

/**
 *  Dodaje załącznik do dokumentu 
 *   
 *  @param fileContent String - Tablica z parametrami
 *  @param fileName String - nazwa pliku
 *  @param documentId Int - identyfikator dokumentu (documents:doc_id)
 *  @param contentTransferEncoding String - kodowanie przesyłanej treści pliku (tylko base64)
 *
 *  @return Int - id pliku jeśli sukces, 0 w razie niepowodzenia
 *   
 *  @throws Exception - SoapFault
 */
Int addAttachmentToDocument(String fileContent, String fileName, Int documentId)

?>

Przykłady wywołań:


// Plik MyService.php umieszczony w apps/edokumenty.
// MyService.php
<?php

define('EDOK_API_LOGIN', 'developer');
define('EDOK_API_PASSWORD', 'developer');
define('DEFAULT_ENTITY_SYMBOL', 'demo');

require_once('./classes/eDokumentyApi/EDokApiClient.inc');

$options = array(
    'location' => 'http://{host}:{port}/eDokumentyApi.php',
    "uri" => "eDokumentyAPI",
    'encoding'=>'UTF-8'
);
        
$client = new EDokApiClient(NULL, $options);
$client->setUser(EDOK_API_LOGIN);
$client->setPass(md5(EDOK_API_PASSWORD));
$header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL);
$client->__setSoapHeaders($header);

// Tworzy kontakt
$contid = NULL;

try {
    $data = array(
        'name_1' => 'SOAP TEST'.date('d H:m:s'),
        'name_2' => 'SOAPTEST',
        'nip___' => 1111111111,
        'street' => 'Główna',       
        'symbol' => 'FGH99'
    );
    $contid = $client->createContact($data);
    var_dump($contid);

} catch(SoapFault $fault) {
    
    var_dump($fault);
    
    if ($fault->faultcode < 100) {
        trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
    }
}

?>