| 1 | = [wiki:DeployerGuide Przewodnik wdrożeniowca] > Pobierz dane o zdarzeniu = |
| 2 | |
| 3 | |
| 4 | ''' Definicja parametrów: ''' |
| 5 | {{{ |
| 6 | #!php |
| 7 | <?php |
| 8 | |
| 9 | /** |
| 10 | * Zwraca dane zdarzenia |
| 11 | * |
| 12 | * @param evntid Int - Id zdarzenia (events:evntid) |
| 13 | * |
| 14 | * @return Array - tablica danych zdarzenia jeśli sukces, SoapFault w razie niepowodzenia |
| 15 | * |
| 16 | * @throws Exception - SoapFault |
| 17 | */ |
| 18 | Array getEvent(Int evntid) |
| 19 | |
| 20 | ?>// Tworzy kontakt |
| 21 | $contid = NULL; |
| 22 | |
| 23 | try { |
| 24 | $data = array( |
| 25 | 'name_1' => 'SOAP TEST'.date('d H:m:s'), |
| 26 | 'name_2' => 'SOAPTEST', |
| 27 | 'nip___' => 1111111111, |
| 28 | 'street' => 'Główna', |
| 29 | 'symbol' => 'FGH99' |
| 30 | ); |
| 31 | $contid = $client->createContact($data); |
| 32 | var_dump($contid); |
| 33 | |
| 34 | } catch(SoapFault $fault) { |
| 35 | |
| 36 | var_dump($fault); |
| 37 | |
| 38 | if ($fault->faultcode < 100) { |
| 39 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 40 | } |
| 41 | } |
| 42 | }}} |
| 43 | |
| 44 | ''' Przykłady wywołań: ''' |
| 45 | {{{ |
| 46 | #!php |
| 47 | |
| 48 | // Plik MyService.php umieszczony w apps/edokumenty. |
| 49 | // MyService.php |
| 50 | <?php |
| 51 | |
| 52 | define('EDOK_API_LOGIN', 'developer'); |
| 53 | define('EDOK_API_PASSWORD', 'developer'); |
| 54 | define('DEFAULT_ENTITY_SYMBOL', 'demo'); |
| 55 | |
| 56 | require_once('./classes/eDo// Tworzy kontakt |
| 57 | $contid = NULL; |
| 58 | |
| 59 | try { |
| 60 | $data = array( |
| 61 | 'name_1' => 'SOAP TEST'.date('d H:m:s'), |
| 62 | 'name_2' => 'SOAPTEST', |
| 63 | 'nip___' => 1111111111, |
| 64 | 'street' => 'Główna', |
| 65 | 'symbol' => 'FGH99' |
| 66 | ); |
| 67 | $contid = $client->createContact($data); |
| 68 | var_dump($contid); |
| 69 | |
| 70 | } catch(SoapFault $fault) { |
| 71 | |
| 72 | var_dump($fault); |
| 73 | |
| 74 | if ($fault->faultcode < 100) { |
| 75 | trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); |
| 76 | } |
| 77 | }kumentyApi/EDokApiClient.inc'); |
| 78 | |
| 79 | $options = array( |
| 80 | 'location' => 'http://{host}:{port}/eDokumentyApi.php', |
| 81 | "uri" => "eDokumentyAPI", |
| 82 | 'encoding'=>'UTF-8' |
| 83 | ); |
| 84 | |
| 85 | $client = new EDokApiClient(NULL, $options); |
| 86 | $client->setUser(EDOK_API_LOGIN); |
| 87 | $client->setPass(md5(EDOK_API_PASSWORD)); |
| 88 | $header = new SoapHeader('eDokumentyAPI', 'entity_symbol', DEFAULT_ENTITY_SYMBOL); |
| 89 | $client->__setSoapHeaders($header); |
| 90 | |
| 91 | |
| 92 | |
| 93 | ?> |
| 94 | }}} |