1 | <?php |
||
2 | /** |
||
3 | * Composer autoload |
||
4 | */ |
||
5 | require_once __DIR__ . '/../vendor/autoload.php'; |
||
6 | require_once __DIR__ . '/settings.inc.php'; |
||
7 | /** |
||
8 | * Used classes |
||
9 | */ |
||
10 | use WsdlToPhp\PackageBase\AbstractSoapClientBase; |
||
11 | use ColissimoPickupPoint\ClassMap; |
||
12 | use ColissimoPickupPoint\ServiceType\Find; |
||
13 | use ColissimoPickupPoint\StructType\FindPointRetraitAcheminementByID; |
||
14 | |||
15 | /** |
||
16 | * Minimal options |
||
17 | */ |
||
18 | $options = array( |
||
19 | AbstractSoapClientBase::WSDL_URL => 'https://ws.colissimo.fr/pointretrait-ws-cxf/PointRetraitServiceWS/2.0?wsdl', |
||
20 | AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get() |
||
21 | ); |
||
22 | /** |
||
23 | * Samples for Find ServiceType |
||
24 | */ |
||
25 | $find = new Find($options); |
||
26 | /** |
||
27 | * Send the request |
||
28 | */ |
||
29 | $result = $find->findPointRetraitAcheminementByID(new FindPointRetraitAcheminementByID(COLISSIMO_WS_CONTRACT_NUMBER, COLISSIMO_WS_PASSWORD, '097297', date('d/m/Y'), '2')); |
||
30 | /** |
||
31 | * Debug informations provided by the utility methods |
||
32 | */ |
||
33 | if (true) { |
||
34 | echo 'XML Request: ' . $find->getLastRequest() . "\r\n"; |
||
35 | echo 'Headers Request: ' . $find->getLastRequestHeaders() . "\r\n"; |
||
36 | echo 'XML Response: ' . $find->getLastResponse() . "\r\n"; |
||
37 | echo 'Headers Response: ' . $find->getLastResponseHeaders() . "\r\n"; |
||
38 | } |
||
39 | /** |
||
40 | * Sample call for getProductInter operation/method |
||
41 | */ |
||
42 | if ($result !== false) { |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
43 | /** |
||
44 | * @var ColissimoPickupPoint\StructType\PointRetraitAcheminementByIDResult |
||
45 | */ |
||
46 | $return = $result->getReturn(); |
||
47 | echo PHP_EOL . sprintf('<br />ErrorCode: %s', $return->getErrorCode()); |
||
48 | echo PHP_EOL . sprintf('<br />ErrorMessage: %s', $return->getErrorMessage()); |
||
49 | if ($return->getErrorCode() <= 0) { |
||
50 | $pointRetraitAcheminement = $return->getPointRetraitAcheminement(); |
||
51 | echo PHP_EOL . "\t\t" . sprintf('<br />Distance %dm', $pointRetraitAcheminement->getDistanceEnMetre()); |
||
52 | echo PHP_EOL . "\t\t" . sprintf('<br />Location %s, %s, %s, %s (%s)', |
||
53 | $pointRetraitAcheminement->getNom(), |
||
54 | $pointRetraitAcheminement->getAdresse1(), |
||
55 | $pointRetraitAcheminement->getLocalite(), |
||
56 | $pointRetraitAcheminement->getLibellePays(), |
||
57 | $pointRetraitAcheminement->getIndiceDeLocalisation()); |
||
58 | echo PHP_EOL . "\t\t" . sprintf("<br />Open hours \r\n\t\t\t<br />Monday: %s, \r\n\t\t\t<br />Tuesday: %s, \r\n\t\t\t<br />Wednesday: %s, \r\n\t\t\t<br />Thursday: %s \r\n\t\t\t<br />Friday: %s, \r\n\t\t\t<br />Saturday: %s, \r\n\t\t\t<br />Sunday: %s", |
||
59 | $pointRetraitAcheminement->getHorairesOuvertureLundi(), |
||
60 | $pointRetraitAcheminement->getHorairesOuvertureMardi(), |
||
61 | $pointRetraitAcheminement->getHorairesOuvertureMercredi(), |
||
62 | $pointRetraitAcheminement->getHorairesOuvertureJeudi(), |
||
63 | $pointRetraitAcheminement->getHorairesOuvertureVendredi(), |
||
64 | $pointRetraitAcheminement->getHorairesOuvertureSamedi(), |
||
65 | $pointRetraitAcheminement->getHorairesOuvertureDimanche()); |
||
66 | } |
||
67 | } else { |
||
68 | echo PHP_EOL . 'An error occurred: ' . $find->getLastErrorForMethod('ColissimoPickupPoint\ServiceType\Find::findPointRetraitAcheminementByID')->getMessage() . PHP_EOL; |
||
69 | } |
||
70 |