| | 1 | = [wiki:DeployerGuide Przewodnik wdrożeniowca] > Pobierz dane osoby kontaktowej = |
| | 2 | |
| | 3 | |
| | 4 | ''' Definicja parametrów: ''' |
| | 5 | {{{ |
| | 6 | #!php |
| | 7 | <?php |
| | 8 | |
| | 9 | /** |
| | 10 | * Pobiera informacje o osobie kontaktowej wraz z cechami. |
| | 11 | * |
| | 12 | * @param int $copeid |
| | 13 | * @param bool $return_json |
| | 14 | * @access public |
| | 15 | * @return array |
| | 16 | * @throws Exception |
| | 17 | */ |
| | 18 | Int getContactPerson(copeid Int, return_json); |
| | 19 | |
| | 20 | |
| | 21 | ?> |
| | 22 | }}} |
| | 23 | |
| | 24 | ''' Przykłady wywołań: ''' |
| | 25 | {{{ |
| | 26 | #!php |
| | 27 | |
| | 28 | // Plik MyService.php umieszczony w apps/edokumenty. |
| | 29 | // MyService.php |
| | 30 | <?php |
| | 31 | |
| | 32 | define('EDOK_API_LOGIN', 'developer'); |
| | 33 | define('EDOK_API_PASSWORD', 'developer'); |
| | 34 | define('DEFAULT_ENTITY_SYMBOL', 'demo'); |
| | 35 | |
| | 36 | require_once('./classes/eDokumentyApi/EDokApiClient.inc'); |
| | 37 | |
| | 38 | $options = array( |
| | 39 | 'location' => 'http://{host}:{port}/eDokumentyApi.php', |
| | 40 | "uri" => "eDokumentyAPI", |
| | 41 | 'encoding'=>'UTF-8' |
| | 42 | ); |
| | 43 | |
| | 44 | $client = new EDokApiClient(NULL, $options); |
| | 45 | $client->setUser(EDOK_API_LOGIN); |
| | 46 | $client->setPass(md5(EDOK_API_PASSWORD)); |
| | 47 | $header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL); |
| | 48 | $client->__setSoapHeaders($header); |
| | 49 | |
| | 50 | try { |
| | 51 | $contactPerson = $client->getContacPerson(578, false); |
| | 52 | var_dump($contactPerson); |
| | 53 | } catch(SoapFault $fault) { |
| | 54 | |
| | 55 | var_dump($fault); |
| | 56 | |
| | 57 | if ($fault->faultcode < 100) { |
| | 58 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| | 59 | } |
| | 60 | } |
| | 61 | |
| | 62 | ?> |
| | 63 | }}} |