我是编程初学者,并且遇到了肥皂电话问题。
我想从 DHL 获得基于 64 位的货件标签。我通常与 Rest 合作,但 DHL 在德国只有 SOAP。
我收到此错误:
SOAP-ENV:ServerUncaught SoapFault 异常:[soap:Receiver] UNKNOWN_ERROR in /homepages/12/d573220848/htdocs/beta/dhl/index.php:90 堆栈跟踪:#0 /homepages/12/d573220848/htdocs/beta/dhl /index.php(90): SoapClient->__soapCall('createShipmentO...', Array, Array) #1 {main} 抛出
我认为身份验证有效
这是我作为客户端的 php 代码
$wsdl = 'https://cig.dhl.de/cig-wsdls/com/dpdhl/wsdl/geschaeftskundenversand-api/2.2/geschaeftskundenversand-api-2.2.wsdl';
$params = array(
'location' => "https://cig.dhl.de/services/sandbox/soap",
'uri' => "https://",
'login' => "*userid*",
'password' => "*secret_password*",
'soap_version' => SOAP_1_2,
'exceptions' => True,
'trace' => 1
);
$client = new SoapClient($wsdl, $params);
$header = new SoapHeader("https://cig.dhl.de/services/sandbox/soap", "authentication", "Basic [EDITED]");
use_soap_error_handler(true);
//Funktionen und Typen anfragen
echo '<h3>Funktionen</h3>';
$functions = $client->__getFunctions();
foreach($functions as $d){
echo "<br>".$d;
}
echo '<br><h3>Types</h3>';
$types = $client->__getTypes();
foreach($types as $t){
echo "<br>".$t;
}
echo '<br><br>';
$request = array(
'CreateShipmentOrderRequest' => "1",
'Version' => array(
'majorRelease' => "2",
'minorRelease' => "0"),
'ShipmentOrder' => array(
'SequenceNumber' => "01",
'Shipment' => array(
'ShipmentDetails' => array(
'product' => "V01PAK",
'accountNumber' => "22222222220101")))
);
//RESPONSE
$response = $client ->__soapCall("createShipmentOrder", $request, $params);
var_dump($response);
echo '<br><br>';
我得到了所有的类型和功能,但没有要求。这是来自dhl的纪录片:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cis="http://dhl.de/webservice/cisbase"
xmlns:bcs="http://dhl.de/webservices/businesscustomershipping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<cis:Authentification>
<cis:user>2222222222_01</cis:user>
<cis:signature>pass</cis:signature>
</cis:Authentification>
</soap:Header>
<soap:Body>
...
</soap:Body>
</soap:Envelope>
Die Abrechnungsnummern müssen zusammen mit dem Produkt im SOAP-Body im Type "Shipment Details" eingetragen werden:
</soap:Header>
<soap:Body>
<bcs:CreateShipmentOrderRequest>
<cis:Version>
<cis:majorRelease>2</cis:majorRelease>
<cis:minorRelease>0</cis:minorRelease>
</cis:Version>
<ShipmentOrder>
<SequenceNumber>01</SequenceNumber>
<Shipment>
<ShipmentDetails>
<product>V01PAK</product>
<cis:accountNumber>22222222220101</cis:accountNumber>
我该怎么做才能让它发挥作用?