<SendPreadvicesToDelivery xmlns="https://api. hermes-dpd. ru/WS/rest" xmlns:a="http://schemas. /2003/10/Serialization/Arrays">

  <businessUnitCode>1000</businessUnitCode>

  <parcelBarcodes>

  <a:string>10009900000002</a:string>

  </parcelBarcodes>

</SendPreadvicesToDelivery>


DeletePreadvice - удаления предзаказов

<?xml version="1.0" encoding="UTF-8"?>

<DeletePreadvice xmlns="https://api. hermes-dpd. ru/WS/rest" xmlns:a="http://schemas. /2003/10/Serialization/Arrays">

  <parcelBarcodes>

  <a:string>10009900000002</a:string>

  </parcelBarcodes>

</DeletePreadvice>



Для комплексных объектов, такие как Preadvice, ExtraParam, необходимо указать пустой неймспейс для корректной десериализации xmlns="" Все условия собраны в ниже приведенном примере

<?xml version="1.0" encoding="UTF-8"?>

<CreatePreadvice xmlns="https://api. hermes-dpd. ru/WS/rest" xmlns:a="http://schemas. /2003/10/Serialization/Arrays" xmlns:i="http://www. w3.org/2001/XMLSchema-instance">

  <preadvices>

  <Preadvice xmlns="">

  <BusinessUnitCode>1000</BusinessUnitCode>

  <CashOnDeliveryCurrency>RUB</CashOnDeliveryCurrency>

  <CashOnDeliveryValue>1500</CashOnDeliveryValue>

  <ClientOrderNumber>111222</ClientOrderNumber>

  <ClientParcelNumber>1113</ClientParcelNumber>

НЕ нашли? Не то? Что вы ищете?

  <CustomStoragePeriod>23</CustomStoragePeriod>

  <CustomerAdditionalAddressInfo>1312</CustomerAdditionalAddressInfo>

  <CustomerAdditionalPhoneNumber>321</CustomerAdditionalPhoneNumber>

  <CustomerApartmentNumber>321</CustomerApartmentNumber>

  <CustomerBuildingNumber>1312</CustomerBuildingNumber>

  <CustomerCity>MOSCOW</CustomerCity>

  <CustomerConstructionNumber>1</CustomerConstructionNumber>

  <CustomerCountryCode>RUS</CustomerCountryCode>

  <CustomerEmail>*****@***ru</CustomerEmail>

  <CustomerFarthersName>a</CustomerFarthersName>

  <CustomerFirstName>g</CustomerFirstName>

  <CustomerFrameNumber>1</CustomerFrameNumber>

  <CustomerLandlinePhoneNumber>21321321</CustomerLandlinePhoneNumber>

  <CustomerMobilePhoneNumber>321321321</CustomerMobilePhoneNumber>

  <CustomerNumber>21321321</CustomerNumber>

  <CustomerRegion>321321 rr</CustomerRegion>

  <CustomerStreet>saras</CustomerStreet>

  <CustomerStreetType>ra</CustomerStreetType>

  <CustomerSubregion>r2r32r32</CustomerSubregion>

  <CustomerSurname>молчанова</CustomerSurname>

  <BusinessUnitCode>1000</BusinessUnitCode>

  <CustomerZipCode>123456</CustomerZipCode>

  <DirectDistributionCenterCode>437</DirectDistributionCenterCode>

  <DispatchDate i:nil="true" />

  <ExtraParams i:nil="true" />

  <InsuranceCurrency>RUB</InsuranceCurrency>

  <InsuranceValue>1000</InsuranceValue>

  <OrderPlacementTimestamp>2014-12-01T14:35:05.000</OrderPlacementTimestamp>

  <ParcelBarcode />

  <ParcelHeight>21321</ParcelHeight>

  <ParcelLength>1321</ParcelLength>

  <ParcelWeight>321</ParcelWeight>

  <ParcelWidth>1321</ParcelWidth>

  <ParcelshopCode>935002</ParcelshopCode>

  <ReturnDistributionCenterCode />

  <Services>

  <a:string>DIRECT_DELIVERY</a:string>

  </Services>

  </Preadvice>

  </preadvices>

</CreatePreadvice>

Запрос на PHP

<?php

error_reporting(E_ALL);

try { 

       $user = "testlogin";

       $pass = "testpassword";

       $bucode = "1000";

       

       

       GetParcelShops_Rest($user, $pass, $bucode);

       //GetParcelShops_Soap($user, $pass, $bucode);

       CreatePreadvice_Rest($user, $pass, $bucode);        

       

}

catch (SoapFault $fault) {

  $error = "Fault: (faultcode: {$fault->faultcode}\n" . "faultstring: {$fault->faultstring})";

  echo $error;

}

catch (Exception $exception) {

  echo "<br/>" . $exception;

}

function GetParcelShops_Rest($user, $pass, $bucode)

{

       echo "REST request... (json)<br/><br/>";

       

       //------------------------------------------------------------------

       $location = "https://test-api. hermes-dpd. ru/WS/RestService. svc/rest";

       

       $access_token = base64_encode($user.":".$pass);

       

       $method = "/GetParcelShops";

         $url = "https://test-api. hermes-dpd. ru/WS/RestService. svc/rest" . $method;

         $data  = json_encode(array('businessUnitCode' => $bucode));         

       

       echo $data;

       

         // set up the request context

         $options = array("http" => array(

         "method" => "POST",

         "header" => array("Authorization: Basic " . $access_token,

         "Content-Type: application/json"),

         "content" => $data

         ));

         $context = stream_context_create($options);         

         // make the request

         $response = file_get_contents($url, false, $context);         

       echo "<br/><br/><br/><br/>REST response... <br/><br/>";        

       echo $response; 

}

function CreatePreadvice_Rest($user, $pass, $bucode)

{

               echo "REST request... (json)<br/><br/>";

       

       //------------------------------------------------------------------

       $location = "https://test-api. hermes-dpd. ru/WS/RestService. svc/rest";

       

       $access_token = base64_encode($user.":".$pass);

       

       $method = "/CreatePreadvice";

         $url = "https://test-api. hermes-dpd. ru/WS/RestService. svc/rest" . $method;

       

       //just grab json from http://test-api. hermes-dpd. ru/rest_main. html

       //and decode it to obj or use as context in a request

       $data =

               '{

                "preadvices": [

                       {

                        "BusinessUnitCode": ' . $bucode. ',

                        "CashOnDeliveryCurrency": "RUB",

                        "CashOnDeliveryValue": 100,

                        "ClientOrderNumber": "TEST_1",

                        "ClientParcelNumber": "TEST_1",

                        "CustomStoragePeriod": 0,

                        "CustomerAdditionalAddressInfo": "test adr info",

                        "CustomerAdditionalPhoneNumber": "test adr phone",

                        "CustomerApartmentNumber": "0",

                        "CustomerBuildingNumber": "13",

                        "CustomerCity": "MOSCOW",

                        "CustomerConstructionNumber": "3",

                        "CustomerCountryCode": "RUS",

                        "CustomerEmail": "*****@***ru",

                        "CustomerFarthersName": "Namegiven X",

                        "CustomerFirstName": "Name X",

                        "CustomerFrameNumber": "1",

                        "CustomerLandlinePhoneNumber": "+7 (499) 681-12-52",

Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 7 8