IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Génération d'étiquette Chronopost : Webservice-SOAP


Sujet :

Langage PHP

  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut Génération d'étiquette Chronopost : Webservice-SOAP
    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 ?

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Je ne sais pas si cela vient de là mais tu as mal écris "length" et "height".
    Il y a peut être d'autres erreurs de ce type.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut
    Erreur corrigées, Merci pour cette relecture avisée L'erreur originelle est toujours présente mais je vais relire à nouveau pour débusquer d’éventuelles erreurs.

  4. #4
    Modérateur
    Avatar de Vil'Coyote
    Homme Profil pro
    Développeur adélia & Web
    Inscrit en
    Février 2008
    Messages
    4 583
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur adélia & Web
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2008
    Messages : 4 583
    Par défaut
    dans ces cas là, je fait une sortie texte de ce que j'envoi à mon webservice et je le test dans soapui.
    cela permet de voir un peu plus facilement là ou le code à généré une erreur.
    la vie n'est pas cirrhose des foies ...

    Avant de poster un message Rechercher n'est pas qu'une option.
    FAQ Web - Tuto Web

  5. #5
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut
    re !

    Bon ca fait un peu de temps mais je me suis remis dessus. SoapUI aide pour la requête en xml mais une fois que je le transforme en array PHP ca marche plus.
    Je me pose la question : si dasn le xml il y a :

    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
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cxf="http://cxf.shipping.soap.chronopost.fr/">
       <soapenv:Header/>
       <soapenv:Body>
          <cxf:shippingMultiParcelWithReservation>
             <!--Optional:-->
     
             <!--Optional:-->
     
             <headerValue>
                <!--type: int-->
                <accountNumber>19869502</accountNumber>
                <!--Optional:-->
                <!--type: string-->
                <idEmit>CHRFR</idEmit>
                <!--Optional:-->
                <!--type: string-->
                <identWebPro></identWebPro>
                <!--type: int-->
                <subAccount></subAccount>
             </headerValue>
             <!--Optional:-->
             <shipperValue>
                <!--Optional:-->
                <!--type: string-->
                <shipperAdress1>40 RUE JEAN JAURES</shipperAdress1>
                <!--Optional:-->
                <!--type: string-->
                <shipperAdress2></shipperAdress2>
                <!--Optional:-->
                <!--type: string-->
                <shipperCity>BAGNOLET</shipperCity>
                <!--Optional:-->
                <!--type: string-->
                <shipperCivility>M</shipperCivility>
                <!--Optional:-->
                <!--type: string-->
                <shipperContactName>Jean MARTIN</shipperContactName>
                <!--Optional:-->
                <!--type: string-->
                <shipperCountry>FR</shipperCountry>
                <!--Optional:-->
                <!--type: string-->
                <shipperCountryName>FRANCE</shipperCountryName>
                <!--Optional:-->
                <!--type: string-->
                <shipperEmail>test@mail.fr</shipperEmail>
                <!--Optional:-->
                <!--type: string-->
                <shipperMobilePhone>0602030405</shipperMobilePhone>
                <!--Optional:-->
                <!--type: string-->
                <shipperName>ETABLISSEMENTS ET FILS</shipperName>
                <!--Optional:-->
                <!--type: string-->
                <shipperName2></shipperName2>
                <!--Optional:-->
                <!--type: string-->
                <shipperPhone>0122222222</shipperPhone>
                <!--type: int-->
                <shipperPreAlert>0</shipperPreAlert>
                <!--Optional:-->
                <!--type: string-->
                <shipperZipCode>93170</shipperZipCode>
             </shipperValue>
    ETC ...
    *
    Est ce que je dois mettre des sous array dasn mon tableau associatif ? Du style
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    $params = { 
        'headerValue' => {
             'param' => $value
        },
        'shipperValue' => {
             'param' => $value
        },
    }

  6. #6
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut
    Bien après quelques recherches j'ai trouvé mon bonheur : STACKOVERFLOW RULZ

    En effet il faut créer une classe et tout...

    Je reviendrait poster mon code quand ça fonctionnera avant de résoudre la discussion

  7. #7
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut
    Bien voila un exemple d'utilisation du webservice chronopost ShippingMultiParcelWithReservation, je n'ai pas utilisé de classe pour les paramètres car j'avais déja mon tableau quasiment fini et la flemme de tout refaire

    Voici le graal païen que j'ai trouvé et que je vous livre a présent :

    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
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    <?php
     
    	//Initialisation des valeurs
    	$civility = 'M';
    	$surname = 'André';
    	$firstname = 'DESFEYSSE';
    	$adress = '69 rue de la république';
    	$adress2 = 'a gauche au fond de l impasse';
    	$city = 'Alix';
    	$countrycode = 'FR';
    	$countryname = 'FRANCE';
    	$completename = 'André DESFEYSSE';
    	$email = 'Test@gmail.com';
    	$mobilephonenumber = '0696911001';
    	$phonenumber = '0449691100';
    	$zipcode = '69210';
    	$commandeNo = '000000000000001';
    	$articleNo ='24';
    	$productcode = '16';
    	//Generate a date at ISO 8601 format 2004-02-12T15:19:21+00:00
    	$shippingdate = date('c');
    	$weight = '2';
    	$numberofparcel = '1';
    	$height = '10';
    	$length = '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(
     
    		//STRUCTURE HEADER VALUE
    		'headerValue' => array(
    			'accountNumber' => '666666666',
    			'idEmit' => 'CHFR',
    			'identWebPro' => '',
    			'subAccount' => '',
    		),
    		//STRUCTURE SHIPPERVALUE
    		'shipperValue' => array(
    			'shipperAdress1' => $adress,
    			'shipperAdress2' => $adress2,
    			'shipperCity' => $city,
    			'shipperCivility' => $civility,
    			'shipperContactName' => $completename,
    			'shipperCountry' => $countrycode,
    			'shipperCountryName' => $countryname,
    			'shipperEmail' => $email,
    			'shipperMobilePhone' => $mobilephonenumber,
    			'shipperName' => $surname,
    			'shipperName2' => $firstname,
    			'shipperPhone' => $phonenumber,
    			'shipperPreAlert' => 0,
    			'shipperZipCode' => $zipcode,
    		),
    		//STRUCTURE CUSTOMERVALUE
    		'customerValue' => array(
    	        'customerAdress1' =>'40 RUE JEAN JAURES',
    	        'customerAdress2' => '',
    	        'customerCity' =>'BAGNOLET',
    	        'customerCivility' =>'M',
    	        'customerContactName' =>'Jean MARTIN',
    	        'customerCountry' =>'FR',
    	        'customerCountryName' =>'FRANCE',
    	        'customerEmail' =>'client@mail.fr',
    	        'customerMobilePhone' =>'0611223344',
    	        'customerName' =>'ETABLISSEMENTS ET FILS',
    	        'customerName2' => '',
    	        'customerPhone' =>'0133333333',
    	        'customerPreAlert' => 0,
    	        'customerZipCode' =>'93170',
    	        'printAsSender' =>'N',
    	    ),
    		//STRUCTURE RECIPIENTVALUE
    		'recipientValue' => array(
    			'recipientAdress1' => '3 Route des Pierres noires',
    			'recipientAdress2' => '',
    			'recipientCity' => 'Eugrèzie la Nevarre',
    			'recipientContactName' => 'BRIBES DINFO',
    			'recipientCountry' => 'FR',
    			'recipientCountryName' => 'FRANCE',
    			'recipientEmail' => 'test@gmail.com',
    			'recipientMobilePhone' => '06666666',
    			'recipientName' => 'BRIBES DINFO',
    			'recipientName2' => '',
    			'recipientPhone' => '044444444',
    	        'recipientPreAlert' => 0,
    			'recipientZipCode' => '06920',
    			//'recipientCivility' => 'M',
    		),		
    		//STRUCTURE REFVALUE
    		'refValue' => array (
    	        'customerSkybillNumber' => '123456789',
    	        'PCardTransactionNumber' =>'',
    			'recipientRef' => $articleNo,
    			'shipperRef' => $commandeNo,
    		),
    		//STRUCTURE SKYBILLVALUE
    		'skybillValue' => array(
    	        'bulkNumber' => 2,
    	        'codCurrency' => 'EUR',
    	        'codValue' => 0,
    	        'customsCurrency' =>'EUR',
    	        'customsValue' => 0,
    	        'evtCode' => 'DC',
    	        'insuredCurrency' => 'EUR',
    	        'insuredValue' => 0,
    	        'masterSkybillNumber' => '?',
    	        'objectType' => 'MAR',
    	        'portCurrency' =>'EUR',
    	        'portValue' => 0,
    			'productCode' => $productcode,
    	        'service' => '0',
    	        'shipDate' => $shippingdate,
    			'shipHour' => '10',
    	        'skybillRank' => 1,
    			'weight' => $weight,
    			'weightUnit' => 'KGM',
    			'height' => $height,
    			'length' => $length,
    			'width' => $width,
    		),
            //STRUCTURE SKYBILLPARAMSVALUE
            'skybillParamsValue' => array(
    			'mode' => 'PDF',
    		),
    		//OTHERS
    		'password' => 'XXXXXXX',
    		'modeRetour' => '2',
    		'numberOfParcel' => $numberofparcel,
            'version' => '2.0',
    		'multiparcel' => 'Y',
    	);
     
        // YOU CAN FIND PARAMETERS YOU NEED IN HERE
        //var_dump($client_ch->__getFunctions());
        //var_dump($client_ch->__getTypes());
     
     
        try {
            $results = $client_ch->shippingMultiParcelWithReservation($params);
            //var_dump($results);
        }
        catch (SoapFault $soapFault) {
            var_dump($soapFault);
            echo "Request :<br>", htmlentities($client_ch->__getLastRequest()), "<br>";
            echo "Response :<br>", htmlentities($client_ch->__getLastResponse()), "<br>";
        }
        if( isset($results)){
        	$reservationNumber = $results->return->reservationNumber;
        	echo $reservationNumber;
    		try {
    	        $results = $client_ch->getReservedSkybill($reservationNumber);
    	        var_dump($results);
    	    }
    	    catch (SoapFault $soapFault) {
    	        var_dump($soapFault);
    	        echo "Request :<br>", htmlentities($client_ch->__getLastRequest()), "<br>";
    	        echo "Response :<br>", htmlentities($client_ch->__getLastResponse()), "<br>";
    	    }
        }
     
    ?>
    Encore merci a vous qui m'avez aidé dans ma quête

  8. #8
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 30
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 16
    Par défaut
    Bonjour !! Bien voici mon code apres modification !
    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
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    <?php
     
        //Initialisation des valeurs
        $civility = 'M';
        $surname = 'André';
        $firstname = 'DEFERRE';
        $adress = '69 rue de la république';
        $adress2 = 'a gauche au fond de l impasse';
        $city = 'Alix';
        $countrycode = 'FR';
        $countryname = 'FRANCE';
        $completename = 'André DEFERRE';
        $email = 'test@gmail.com';
        $mobilephonenumber = '0611223344';
        $phonenumber = '041122344';
        $zipcode = '69210';
        $commandeNo = '000000000000001';
        $articleNo ='24';
        $productcode = '16';
        $shippingdate = date('c');
        $weight = '2';
        $numberofparcel = '1';
        $height = '10';
        $length = '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(
     
            //STRUCTURE HEADER VALUE
            'headerValue' => array(
                'accountNumber' => '19869502',
                'idEmit' => 'CHRFR',
                'identWebPro' => '',
                'subAccount' => '',
            ),
            //STRUCTURE SHIPPERVALUE
            'shipperValue' => array(
                'shipperAdress1' => $adress,
                'shipperAdress2' => $adress2,
                'shipperCity' => $city,
                'shipperCivility' => $civility,
                'shipperContactName' => $completename,
                'shipperCountry' => $countrycode,
                'shipperCountryName' => $countryname,
                'shipperEmail' => $email,
                'shipperMobilePhone' => $mobilephonenumber,
                'shipperName' => $surname,
                'shipperName2' => $firstname,
                'shipperPhone' => $phonenumber,
                'shipperPreAlert' => 0,
                'shipperZipCode' => $zipcode,
            ),
            //STRUCTURE CUSTOMERVALUE
            'customerValue' => array(
                'customerAdress1' =>'40 RUE JEAN JAURES',
                'customerAdress2' => '',
                'customerCity' =>'BAGNOLET',
                'customerCivility' =>'M',
                'customerContactName' =>'Jean MARTIN',
                'customerCountry' =>'FR',
                'customerCountryName' =>'FRANCE',
                'customerEmail' =>'client@mail.fr',
                'customerMobilePhone' =>'0611223344',
                'customerName' =>'ETABLISSEMENTS ET FILS',
                'customerName2' => '',
                'customerPhone' =>'0133333333',
                'customerPreAlert' => 0,
                'customerZipCode' =>'93170',
                'printAsSender' =>'N',
            ),
            //STRUCTURE RECIPIENTVALUE
            'recipientValue' => array(
                'recipientAdress1' => '3 Route des Pierres Blanches',
                'recipientAdress2' => '',
                'recipientCity' => 'TESTcity',
                'recipientContactName' => 'CLIENT',
                'recipientCountry' => 'FR',
                'recipientCountryName' => 'FRANCE',
                'recipientEmail' => 'test@gmail.com',
                'recipientMobilePhone' => '0655667788',
                'recipientName' => 'CLIENTname',
                'recipientName2' => '',
                'recipientPhone' => '0455667788',
                'recipientPreAlert' => 0,
                'recipientZipCode' => '69190',
                //'recipientCivility' => 'M',
            ),     
            //STRUCTURE REFVALUE
            'refValue' => array (
                'customerSkybillNumber' => '123456789',
                'PCardTransactionNumber' =>'',
                'recipientRef' => $articleNo,
                'shipperRef' => $commandeNo,
            ),
            //STRUCTURE SKYBILLVALUE
            'skybillValue' => array(
                'bulkNumber' => 1,
                'codCurrency' => 'EUR',
                'codValue' => 0,
                'customsCurrency' =>'EUR',
                'customsValue' => 0,
                'evtCode' => 'DC',
                'insuredCurrency' => 'EUR',
                'insuredValue' => 0,
                'masterSkybillNumber' => '?',
                'objectType' => 'MAR',
                'portCurrency' =>'EUR',
                'portValue' => 0,
                'productCode' => $productcode,
                'service' => '0',
                'shipDate' => $shippingdate,
                'shipHour' => '10',
                'skybillRank' => 1,
                'weight' => $weight,
                'weightUnit' => 'KGM',
                'height' => $height,
                'length' => $length,
                'width' => $width,
            ),
            //STRUCTURE SKYBILLPARAMSVALUE
            'skybillParamsValue' => array(
                'mode' => 'PDF',
            ),
            //OTHERS
            'password' => '255562',
            'modeRetour' => '2',
            'numberOfParcel' => $numberofparcel,
            'version' => '2.0',
            'multiparcel' => 'N',
        );
     
        // YOU CAN FIND PARAMETERS YOU NEED IN HERE
        //var_dump($client_ch->__getFunctions());
        //var_dump($client_ch->__getTypes());
     
     
        try {
            $results = $client_ch->shippingMultiParcelWithReservation($params);
            //var_dump($results);
        }
        catch (SoapFault $soapFault) {
            var_dump($soapFault);
            echo "Request :<br>", htmlentities($client_ch->__getLastRequest()), "<br>";
            echo "Response :<br>", htmlentities($client_ch->__getLastResponse()), "<br>";
        }
        if( isset($results)){
            $reservationNumber = $results->return->reservationNumber;
            echo $reservationNumber;
            try {
                $results = $client_ch->getReservedSkybill($reservationNumber);
                var_dump($results);
            }
            catch (SoapFault $soapFault) {
                var_dump($soapFault);
                echo "Request :<br>", htmlentities($client_ch->__getLastRequest()), "<br>";
                echo "Response :<br>", htmlentities($client_ch->__getLastResponse()), "<br>";
            }
        }
     
    ?>
    Voila si quelqu'un a des remarques à faire, je suis là !

  9. #9
    Membre averti
    Inscrit en
    Juillet 2006
    Messages
    16
    Détails du profil
    Informations forums :
    Inscription : Juillet 2006
    Messages : 16
    Par défaut
    Bonjour,

    J'ai vu dans ton message que tu dis avoir la doc des webservices de Chronopost.
    J'ai écumé pas mal le web pour trouver cette doc mais rien à faire.
    Est-ce que par hasard tu pourrais me la fournir ? ce serait cool

  10. #10
    Modérateur
    Avatar de Vil'Coyote
    Homme Profil pro
    Développeur adélia & Web
    Inscrit en
    Février 2008
    Messages
    4 583
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur adélia & Web
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2008
    Messages : 4 583
    Par défaut
    la doc n'est dispo que pour les client pro pas pour le perso il me semble de même que l'accès au webservice est limité aux clients.
    la vie n'est pas cirrhose des foies ...

    Avant de poster un message Rechercher n'est pas qu'une option.
    FAQ Web - Tuto Web

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Génération de Client de webservice SOAP
    Par habibouss dans le forum Services Web
    Réponses: 0
    Dernier message: 03/08/2014, 02h33
  2. [Web Service] Appel Webservice SOAP
    Par HaTnuX dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 16/08/2008, 22h33
  3. webservices soap et php
    Par manuscle dans le forum WinDev
    Réponses: 0
    Dernier message: 16/04/2008, 16h35
  4. Réponses: 1
    Dernier message: 13/02/2007, 17h43
  5. Webservice SOAP et fichier attaché ?
    Par Bruno13 dans le forum Services Web
    Réponses: 13
    Dernier message: 03/04/2006, 17h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo