我正在尝试从 dpd.com 获取运输标签。为此,我需要使用肥皂来完成任务。我已经完成了登录认证并获得了 AuthToken。这是代码。
<?php
$c = new SoapClient('https://public-ws-stage.dpd.com/services/LoginService/V2_0/?WSDL');
$res = $c->getAuth(array(
'delisId' => 'username',
'password' => 'password',
'messageLanguage' => 'en-us',
));
$authToken = $res->return->authToken;
现在,问题是我想通过发送请求并使用此 AuthToken 来获取运输标签。肥皂请求的格式是这样的。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://dpd.com/common/service/types/Authentication/2.0"
xmlns1="https://public-ws-stage.dpd.com/services/ShipmentService/V3_2/?wsdl">
<soapenv:Header>
<ns:authentication>
<delisId>username</delisId>
<authToken>AuthToken From Above</ authToken>
<messageLanguage>en-us</messageLanguage>
</ns:authentication>
</soapenv:Header>
<soapenv:Body>
<ns1:storeOrders>
<paperFormat>A4</paperFormat>
<order>
<generalShipmentData>
<sendingDepot>'.$depot_num.'</sendingDepot>
<product>CL</product>
<mpsCompleteDeliver>false</mpsCompleteDeliver>
<sender>
<name1>Fritz</name1>
<street>Mustergasse</street>
<houseNo>1</houseNo>
<state>BY</state>
<country>DE</country>
<zipCode>53950</zipCode>
<city>Maibach</city>
</sender>
<recipient>
<name1></name1>
<street></street>
<houseNo></houseNo>
<state></state>
<country></country>
<zipCode></zipCode>
<city></city>
</recipient>
</generalShipmentData>
<parcels>
<parcelLabelNumber></parcelLabelNumber>
</parcels>
<productAndServiceData>
<orderTyp></orderType>
</productAndServiceData>
</order>
</ns1:storeOrdes>
</soapenv:Body>
</soapenv:Envelope>
但我不知道如何发送此请求并在 pdfData 标签中获取响应。