Подключение к веб-сервису Агентов МЭ по продукту ЭКСПРЕСС-ДОСТАВКА на примере Postman

Веб-сервис Агентов МЭ располагается по адресу: https://agents.major-express.ru/Manifest.asmx
Для отправки запросов в ознакомительных целях и настройки интеграции развернута «песочница» по адресу:
https://stage-agents.major-express.ru/Manifest.asmx
Для удобства знакомства к статье приложена postman-коллекция с запросами, описанными ниже.

Получение файла WSDL

I. Перейти на страницу веб-сервиса: https://stage-agents.major-express.ru/Manifest.asmx,


II. Перейти по гиперссылке Service Description
III. Сохранить страницу как… (Ctrl+S):

Добавление сервиса в коллекцию Postman

I. Во вкладке Collections вашего Workspace нажать на Import:

II. В открывшемся окне выбрать “Select Files”:

III. Загрузить скачанный WSDL-файл:

IV. Нажать “Import”:

V. Коллекция добавлена:

1. Авторизация в сервисе (метод me_Login):

Для авторизации запросов в сервисе используется токен, возвращаемый в ответе метода me_Login.
Для его получения требуется передать в запросе валидные данные учетной записи Агента МЭ, подключенного к веб-сервису.
Важно: Если при автоматической генерации контракта в нем были сформированы параметры с namespase “tns:” – удалите этот неймспейс из запросов.
(например: <tns:me_Login> -> <me_Login>)

В ответе на запрос будет содержаться объект TicketHeader с четырьмя вложенными параметрами (Ticket, UserName, CheckSum, inRole).
Время жизни тикета – 15 минут с момента последней активности

Во всех методах веб-сервиса, кроме me_Login, требуется передавать этот объект в soap:Header тела (Body) POST-запроса. Примеры использования будут приведены ниже

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/me_Login' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <me_Login xmlns="http://tempuri.org/">
      <me_Login>****</me_Login>
      <me_Password>**** </me_Password>
    </me_Login>
  </soap:Body>
</soap:Envelope>
'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1 
Host: stage-agents.major-express.ru 
Content-Type: text/xml; 
charset=utf-8 
SOAPAction: http://tempuri.org/me_Login 
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; 
ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5 
Content-Length: 296 
<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
 <soap:Body> 
  <me_Login xmlns="http://tempuri.org/"> 
   <me_Login>****</me_Login> 
   <me_Password>**** </me_Password> 
  </me_Login> 
 </soap:Body> 
</soap:Envelope>

2. Список Клиентов Агента МЭ (метод me_ClientsForAgents):

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/me_ClientsForAgents' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=hqsjn21jf2zrm0ja2vex0mcf' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>

            <UserName>{{AgetUsername}}</UserName>             <CheckSum>{{AgentCheckSum}}</CheckSum>             <inRole>{{AgentInRole}}</inRole>         </TicketHeader> </soap:Header>   <soap:Body>     <me_ClientsForAgents xmlns="http://tempuri.org/"/>   </soap:Body> </soap:Envelope>'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1
Host: stage-agents.major-express.ru
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/me_ClientsForAgents
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=hqsjn21jf2zrm0ja2vex0mcf
Content-Length: 494
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <TicketHeader xmlns="http://tempuri.org/">
      <Ticket>{{AgentAuthTicket}}</Ticket>
      <UserName>{{AgetUsername}}</UserName>
      <CheckSum>{{AgentCheckSum}}</CheckSum>
      <inRole>{{AgentInRole}}</inRole>
    </TicketHeader>
  </soap:Header>
  <soap:Body>
    <me_ClientsForAgents xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>

3. Проверка статуса плательщика (метод Me_VerifyPayerNum):

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/Me_VerifyPayerNum' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <Me_VerifyPayerNum xmlns="http://tempuri.org/">
      <PayerNum>110243</PayerNum>
    </Me_VerifyPayerNum>
  </soap:Body>
</soap:Envelope>'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1
Host: stage-agents.major-express.ru
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/Me_VerifyPayerNum
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5
Content-Length: 572
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <Me_VerifyPayerNum xmlns="http://tempuri.org/">
      <PayerNum>110243</PayerNum>
    </Me_VerifyPayerNum>
  </soap:Body>
</soap:Envelope>

4. Получение городов (метод me_allCitiesWithZones):

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/me_allCitiesWithZones' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <me_allCitiesWithZones xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1
Host: stage-agents.major-express.ru
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/me_allCitiesWithZones
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5
Content-Length: 518
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <me_allCitiesWithZones xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>

5. Получение временных интервалов (метод Dict_Order_CreationTimeIntervals):

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/Dict_Order_CreationTimeIntervals' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <Dict_Order_CreationTimeIntervals xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1
Host: stage-agents.major-express.ru
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/Dict_Order_CreationTimeIntervals
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5
Content-Length: 529
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <Dict_Order_CreationTimeIntervals xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>

6. Создание заказа (метод me_OneOrderInput):

Для создания заказа используйте данные справочников, полученные выше:

PayerCode из списка Клиентов Агента (методы me_ClientsForAgents и Me_VerifyPayerNum),
ShipperCityCode и ConsigneeCityCode из списка городов (метод me_allCitiesWithZones),
CargoTakenTimeIntervalId из справочника временных интервалов для заказов (метод Dict_Order_CreationTimeIntervals).
Параметр PaymentType (тип оплаты) принимает на вход значения:
1 - Наличный
2 – Безналичный
Параметр WhoWillPay (сторона оплаты) принимает на вход значения:
1 – Отправитель
2 – Получатель
3 – Третья сторона (по договору МЭ)

Postman

Запрос в виде cURL:
curl -L 'https://stage-agents.major-express.ru/Manifest.asmx' -H 'Content-Type: text/xml; charset=utf-8' -H 'SOAPAction: http://tempuri.org/me_OneOrderInput' -H 'Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5' -d '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <me_OneOrderInput xmlns="http://tempuri.org/">
      <inputInfo>
        <CargoTakenDate>2025-05-28</CargoTakenDate>
        <CargoTakenTimeIntervalId>3</CargoTakenTimeIntervalId>
        <PayerCode>110243</PayerCode>
        <ShipperCompany>Организация Отправителя</ShipperCompany>
        <ShipperLastName>Имя Отправителя</ShipperLastName>
        <ShipperPhone>Телефон Отправителя</ShipperPhone>
        <ShipperPostIndex>109444</ShipperPostIndex>
        <ShipperAddress>Адрес Отправителя</ShipperAddress>
        <ShipperCityCode>129</ShipperCityCode>
        <ConsigneeLastName>Имя Получателя</ConsigneeLastName>
        <ConsigneeCompany>Организация Получателя</ConsigneeCompany>
        <ConsigneePhone>Телефон Получателя</ConsigneePhone>
        <ConsigneePostIndex></ConsigneePostIndex>
        <ConsigneeAddress>Адрес Получателя</ConsigneeAddress>
        <ConsigneeCityCode>122</ConsigneeCityCode>
        <WbPackage>1</WbPackage>
        <WbWeight>7</WbWeight>
        <WbCostRub>3200</WbCostRub>
        <PaymentType>2</PaymentType>
        <WhoWillPay>3</WhoWillPay>
        <WbSizeText>10х10х10</WbSizeText>
        <WbDescription>Описание вложений</WbDescription>
        <Remarks>Особые отметки</Remarks>
      </inputInfo>
    </me_OneOrderInput>
  </soap:Body>
</soap:Envelope>'

Запрос в виде HTTP-request:
POST /Manifest.asmx HTTP/1.1
Host: stage-agents.major-express.ru
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/me_OneOrderInput
Cookie: __ddg1_=o8HQAeCeEEG22MLFrngb; ASP.NET_SessionId=iqtv34chhpsebae4h1mf1ns5
Content-Length: 1731
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
        <TicketHeader xmlns="http://tempuri.org/">
            <Ticket>{{AgentAuthTicket}}</Ticket>
            <UserName>{{AgetUsername}}</UserName>
            <CheckSum>{{AgentCheckSum}}</CheckSum>
            <inRole>{{AgentInRole}}</inRole>
        </TicketHeader>
    </soap:Header>
  <soap:Body>
    <me_OneOrderInput xmlns="http://tempuri.org/">
      <inputInfo>
        <CargoTakenDate>2025-05-28</CargoTakenDate>
        <CargoTakenTimeIntervalId>3</CargoTakenTimeIntervalId>
        <PayerCode>110243</PayerCode>
        <ShipperCompany>Организация Отправителя</ShipperCompany>
        <ShipperLastName>Имя Отправителя</ShipperLastName>
        <ShipperPhone>Телефон Отправителя</ShipperPhone>
        <ShipperPostIndex>109444</ShipperPostIndex>
        <ShipperAddress>Адрес Отправителя</ShipperAddress>
        <ShipperCityCode>129</ShipperCityCode>
        <ConsigneeLastName>Имя Получателя</ConsigneeLastName>
        <ConsigneeCompany>Организация Получателя</ConsigneeCompany>
        <ConsigneePhone>Телефон Получателя</ConsigneePhone>
        <ConsigneePostIndex></ConsigneePostIndex>
        <ConsigneeAddress>Адрес Получателя</ConsigneeAddress>
        <ConsigneeCityCode>122</ConsigneeCityCode>
        <WbPackage>1</WbPackage>
        <WbWeight>7</WbWeight>
        <WbCostRub>3200</WbCostRub>
        <PaymentType>2</PaymentType>
        <WhoWillPay>3</WhoWillPay>
        <WbSizeText>10х10х10</WbSizeText>
        <WbDescription>Описание вложений</WbDescription>
        <Remarks>Особые отметки</Remarks>
      </inputInfo>
    </me_OneOrderInput>
  </soap:Body>
</soap:Envelope>