Bonjour !

J'ai pour mission de générer une étiquette chronopost en utilisant le webservice Chronopost. Pour cela je dois envoyer une requête au serveur avec SOAP. Je n'avais jamais utilisé ce protocole auparavant donc j'ai un peu galéré avant de découvrir la classe soapClient.

Pour générer l’étiquette j'utilise le service shippingMultiParcelWithReservation. Quand je teste mon code en le lançant depuis xampp, en réponse j'ai le errorCode 1 et le errorMessage suivant :

java.lang.NullPointerException at<br> fr.chronopost.soap.shipping.util.PopulateUtils.getSkybillWithDimensionsValueRedresse(PopulateUtils.java:271) at<br> fr.chronopost.soap.shipping.cxf.ShippingServiceWS.shippingMultiParcelWithReservation(ShippingServiceWS.java:136) at<br> sun.reflect.GeneratedMethodAccessor1094.invoke(Unknown Source) at<br> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at<br> java.lang.reflect.Method.invoke(Method.java:606) at
....etc
Je n'ai mis que le début, la suite ne parle que de java invoker tout ca tout ca.
Dans la documentation chronopost ce code erreur correspond à : 'une erreur système'.

Voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
    //Initialisation
    $civility = 'M';
    $surname = 'André';
    $firstname = 'DEFEYSSES';
    $adress = '69 rue de la raie';
    $adress2 = 'a gauche au fond de l impasse';
    $zipcode = '46800';
    $city = 'Montcuq';
    $commandeNo = '000000000000001';
    $articleNo ='24';
    $productcode = '16';
    $shippingdate = '2016-07-12';
    $weight = '2';
    $countrycode = 'FR';
    $completename = 'André DEFEYSSES';
    $email = 'aolcmagik@gmailcom';
    $numberofparcel = '1';
    $height = '10';
    $lenght = '20';
    $width = '20';
 
// WEBSERVICE'S WSDL ADDRESS
    $wsdl = "https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl";
    //CALLING SOAP CLIENT CONSTRUCTOR FUNCTION
    $client_ch = new soapClient($wsdl);
 
    $client_ch->soap_defencoding = 'UTF-8';
    $client_ch->decode_utf8 = false;
 
    // LISTING OF NEEDED PARAMETERS FOR THE SOAP CALL IN AN ARRAY
    $params = array(
        //STRCUTURE ESDVALUE
        /*'RetrievalDateTime' => '',
        'ClosingDateTime' => '',
        'SpecificInstructions' => '',
        'Height' => '',
        'Width' => '',
        'Length' => '',
        'shipperCarriesCode' => '',
        'shipperBuildingFloor' => '',
        'shipperServiceDirection' => '',
        'refEsdClient' => '',
        'nombreDePassageMaximum' => '',
        'ltAImprimerParChronopost' => '',*/
        //STRUCTURE HEADER VALUE
        'idEmit' => 'CHFR',
        'accountNumber' => '666666666',
        'subAccount' => '',
        //STRUCTURE SHIPPERVALUE
        'shipperCivility' => $civility,
        'shipperName' => $surname,
        'shipperName2' => $firstname,
        'shipperAdress1' => $adress,
        'shipperAdress2' => $adress2,
        'shipperZipCode' => $zipcode,
        'shipperCity' => $city,
        //countrycode ↓ ex France : FR
        'shipperCountry' => $countrycode,
        //'shipperCountryName' => $countryname,
        'shipperContactName' => $completename,
        'shipperEmail' => $email,
        //'shipperPhone' => $phonenumber,
        //'shipperMobilePhone' => $mobilephonenumber,
        //'shipperPreAlert' => $prealert,
        //STRUCTURE RECIPIENTVALUE
        'recipientCivility' => 'M',
        'recipientName' => 'MER NOIRE',
        'recipientName2' => '',
        'recipientAdress1' => '3 Route des Pierres Noires',
        'recipientZipCode' => '69290',
        'recipientCity' => 'GOuloum GOuloum',
        'recipientCountry' => 'FR',
        'recipientCountryName' => 'France',
        'recipientContactName' => 'MER NOIRE',
        'recipientEmail' => 'netscapeckool@lol.com',
        'recipientPhone' => '000000000',
        'recipientMobilePhone' => '000000000',
        //STRUCTURE REFVALUE
        'shipperRef' => $commandeNo,
        'recipientRef' => $articleNo,
        //STRUCTURE SKYBILLVALUE
        'productCode' => $productcode,
        'shipDate' => $shippingdate,
        'shipHour' => '10',
        'weight' => $weight,
        'weightUnit' => 'KGM',
        'service' => '0',
        'objectType' => 'MAR',
        'heigth' => $height,
        'lenght' => $lenght,
        'width' => $width,
        //STRUCTURE SKYBILLPARAMS
        'modeRetour' => '2',
        //OTHERS
        'mode' => 'PDF',
        'password' => '6666666',
        'numberOfParcel' => $numberofparcel,
        'multiparcel' => 'Y',
    );
 
    // GET BACK THE RESULTS
    $result = $client_ch->shippingMultiParcelWithReservation($params);
 
    // ERREUR DANS L'APPEL DU SERVICE WEB
    if (is_soap_fault($client_ch)) {
    echo "<h2>Erreur dans l'appel du service web :</h2><pre>";
    print_r($result);
    echo "</pre>";
    }else{
        $errorCode = $result->return->errorMessage;
        echo $errorCode;
        $PDF = $result->return->resultParcelValue;
        var_dump($PDF);
 
}
 
?>
En sachant que lorsqu’il manquait certains paramètres j'avais une erreur précise qui m'indiquait quoi rajouter.

Quelqu'un a -t-il déja utilisé ce service avec succès ? Quelle erreur ai-je pu faire ?