php мыльный клиент для uk mail webservice api?
Я работаю над коммерческим сайтом, на котором размещаются заказы. Для отслеживания этой доставки мне нужно дать ссылку пользователям со всеми параметрами из формы, заполненной пользователем, чтобы создать доставку и отслеживать ее статус с помощью Почты Великобритании со ссылкой, указанной в письме.
Я должен использовать API почтовой веб-службы Великобритании. Может кто-нибудь показать мне, как это сделать? Я новичок в SOAP WSDL.
Из моего понимания я сделал это сейчас, как идти дальше? Мой код ниже просто базовый клиент мне нужно:
authenticate login and use the authenticate token
I need to send the parameters to create a domestic assignments
I need to track the delivery status too
вот мой обновленный код:
<code><?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); ?> </code>
я решил все и получил мой груз не слишком просто нужно отслеживать мой API
мой XML такой или вы можете проверить PDF
<code> 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> </code>
пример ответа xml
<code> <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> </code>