| 1 | = [wiki:DeployerGuide Przewodnik wdrożeniowca] > Pobierz dane o kontrahencie = |
| 2 | |
| 3 | |
| 4 | ''' Definicja parametrów: ''' |
| 5 | {{{ |
| 6 | #!php |
| 7 | <?php |
| 8 | |
| 9 | /** |
| 10 | * Zwraca dane kontaktu wraz z adresem |
| 11 | * |
| 12 | * @param contid Int - Id kontaktu (contacts:contid) |
| 13 | * |
| 14 | * @return Array - tablica danych kontaktu jeśli sukces, SoapFault w razie niepowodzenia |
| 15 | * |
| 16 | * @throws Exception - SoapFault |
| 17 | */ |
| 18 | Array getContact(Int contid) |
| 19 | |
| 20 | ?> |
| 21 | }}} |
| 22 | |
| 23 | ''' Przykłady wywołań: ''' |
| 24 | {{{ |
| 25 | #!php |
| 26 | |
| 27 | // Plik MyService.php umieszczony w apps/edokumenty. |
| 28 | // MyService.php |
| 29 | <?php |
| 30 | |
| 31 | define('EDOK_API_LOGIN', 'developer'); |
| 32 | define('EDOK_API_PASSWORD', 'developer'); |
| 33 | define('DEFAULT_ENTITY_SYMBOL', 'demo'); |
| 34 | |
| 35 | require_once('./classes/eDokumentyApi/EDokApiClient.inc'); |
| 36 | |
| 37 | $options = array( |
| 38 | 'location' => 'http://{host}:{port}/eDokumentyApi.php', |
| 39 | "uri" => "eDokumentyAPI", |
| 40 | 'encoding'=>'UTF-8' |
| 41 | ); |
| 42 | |
| 43 | $client = new EDokApiClient(NULL, $options); |
| 44 | $client->setUser(EDOK_API_LOGIN); |
| 45 | $client->setPass(md5(EDOK_API_PASSWORD)); |
| 46 | $header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL); |
| 47 | $client->__setSoapHeaders($header); |
| 48 | |
| 49 | |
| 50 | |
| 51 | ?> |
| 52 | }}} |