Я работаю над коммерческим сайтом, на котором размещаются заказы. Чтобы отслеживать эту доставку, мне нужно дать пользователям ссылку со всеми параметрами из формы, заполненной пользователем, чтобы создать доставку и отслеживать ее статус с помощью UK Mail по ссылке, указанной в почте.
Я должен использовать UK Mail Web Service API. Может ли кто-нибудь показать мне, как это сделать? Я новичок в SOAP WSDL.
Насколько я понимаю, я сделал это сейчас, как двигаться дальше? Мой код ниже — это просто базовый клиент, который мне нужно:
аутентифицировать вход и использовать токен аутентификации
мне нужно отправить параметры для создания внутренних назначений
мне также нужно отслеживать статус доставки
здесь мой обновленный код:
<?php
$LoginWebRequest = new stdClass();
$LoginWebRequest->Username = 'xxx cant show here xxx';
$LoginWebRequest->Password = 'xxx cant show here xxx';
//echo "<pre>"; print_r($LoginWebRequest); "</pre>"; exit;
$Login = new stdClass();
$Login->loginWebRequest = $LoginWebRequest;
//echo "<pre>"; print_r($Login); "</pre>"; exit;
$soapClient = new SoapClient('somewsdl?wsdl');
$LoginResponse = $soapClient->Login($Login);
//echo "<pre>"; print_r($LoginResponse); "</pre>"; exit;
$LoginResponse = $soapClient->Login($Login);
// -- till here my code runs fine and also gives the failed output but adding the code //below gives me error cant find out whats wrong
$AuthenticationToken = $LoginResponse->LoginResult->AuthenticationToken;
$AddDomesticConsignmentWebRequest = new stdClass();
$AddDomesticConsignmentWebRequest->Username = 'xxxxxx';
// setting the Authentication Token from the previous step
$AddDomesticConsignmentWebRequest->AuthenticationToken = $AuthenticationToken ;
// other properties are set here...
$AddDomesticConsignment = new stdClass();
$AddDomesticConsignment->request = $AddDomesticConsignmentWebRequest;
$soapClient = new SoapClient('https://svc?wsdl');
$AddDomesticConsignmentResponse = $soapClient->AddDomesticConsignment($AddDomesticConsignment);
?>
я решил все и получил свою партию, не слишком просто нужно отслеживать мой API
мой xml такой, или вы можете проверить pdf
Example XML Request:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:thir="http://webapp-cl.internet-delivery.com/ThirdPartyIntegrationService">
<soap:Header/>
<soap:Body>
<thir:ConsignmentTrackingSearchV1>
<thir:UserName>mail.com</thir:UserName>
<thir:Password>123</thir:Password>
<thir:Token></thir:Token>
<thir:ConsignmentNumber>01161</thir:ConsignmentNumber>
<thir:IsPartialConsignmentNumber>false</thir:IsPartialConsignmentNumber>
<thir:CustomerReference></thir:CustomerReference>
<thir:IsPartialCustomerReference>false</thir:IsPartialCustomerReference>
<thir:DeliveryPostCode></thir:DeliveryPostCode>
<thir:MailingID></thir:MailingID>
<thir:MaxResults>100</thir:MaxResults>
</thir:ConsignmentTrackingSearchV1>
</soap:Body>
</soap:Envelope>
пример ответа xml
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ConsignmentTrackingSearchV1Response xmlns="http://webapp-cl.internet- delivery.com/ThirdPartyIntegrationService">
<ConsignmentTrackingSearchV1Result>
<ResultState>Successful</ResultState>
<ConsignmentResults>
<ConsignmentSearchResult>
<ConsignmentNumber>001161</ConsignmentNumber>
<CustomerRef1/>
<CustomerRef2/>
<SubCustomerRef1/>
<SubCustomerRef2/>
<DeliveryType/>
<ConsignmentStatus>Delivered</ConsignmentStatus>
<DateTimeDelivered>2010-02-11T12:00:00+00:00</DateTimeDelivered>
<ItemsDelivered>2</ItemsDelivered>
<RecipientName>robin</RecipientName>
<DeliveryComments/>
<ExpectedDeliveryDate>2010-02-11T00:00:00</ExpectedDeliveryDate>
<DeliveryService>Next Day</DeliveryService>
<TotalItems>2</TotalItems>
<Consignmentkey>22</Consignmentkey>
</ConsignmentSearchResult>
</ConsignmentResults>
</ConsignmentTrackingSearchV1Result>
</ConsignmentTrackingSearchV1Response>
</soap:Body>
</soap:Envelope>