API безбумажных документов UPS. код ошибки: 9590000 Веб-служба безбумажных документов недоступна
URL-адрес документации UPS : https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US Код загрузки PHP:
/**
* 无纸化上传发票
*/
protected function paperlessFileUpload()
{
set_time_limit(0);
ini_set("memory_limit", "-1");
//filexfer wwwcie onlinetools
$urlPaperless= "https://wwwcie.ups.com/webservices/PaperlessDocumentAPI";
$path = '../../backend/web/public/ups/SampleInvoice.pdf';
$this->fileBs64 = base64_encode(file_get_contents($path));
try {
$wsdl = '../../backend/web/public/ups/wsdl/PaperlessDocumentAPI.wsdl';
$mode = array
(
'soap_version' => 'SOAP_1_1', // use soap 1.1 client
'trace' => 1
);
// initialize soap client
$client = new SoapClient($wsdl , $mode);
// print_r($client->__getFunctions());
// print_r($client->__getTypes()); die;
// set endpoint url
$client->__setLocation($this->urlPaperless);
// create soap header
$usernameToken['Username'] = $this->userId;
$usernameToken['Password'] = $this->passWord;
$serviceAccessLicense['AccessLicenseNumber'] = $this->accessLicenseNumber;
$upss['UsernameToken'] = $usernameToken;
$upss['ServiceAccessToken'] = $serviceAccessLicense;
$header = new SoapHeader('http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0','UPSSecurity',$upss);
$client->__setSoapHeaders($header);
//get response
$resp = $client->__soapCall('ProcessUploading',array(processUploading($this->fileBs64)));
//get status
echo '<pre>';
echo "Response Status: " . $resp->Response->ResponseStatus->Description ."\n";
//save soap request and response to file
var_dump($resp->Response);
echo '</pre>';
die;
}catch (\SoapFault $fault){
echo '<pre>';
print_r($fault->faultcode);
print_r($fault->faultstring);
print_r($fault->detail);
echo '</pre>';
die('Errore chiamata webservice UPS');
}catch (\Exception $fault){
print_r($fault->getMessage());
print_r($fault->getLine());
}
}
function processUploading($fileBs64 = '')
{
$ups = new Ups();
//create soap request
$request['Request'] = array
(
'TransactionReference' => array
(
'CustomerContext' => 'Upload Request',
'TransactionIdentifier' => 'String'
)
);
$request['ShipperNumber'] = $ups->shipperNumber;
$request['UserCreatedForm'] = array
(
'UserCreatedFormFileName' => 'SampleInvoice.pdf',
'UserCreatedFormFile' => $fileBs64,
'UserCreatedFormFileFormat' => 'pdf',
'UserCreatedFormDocumentType' => '002'
);
return $request;
}
Это код ошибки, возвращаемый XML-документом:
ServerService Temporarily UnavailablestdClass Object
(
[Errors] => stdClass Object
(
[ErrorDetail] => stdClass Object
(
[Severity] => Transient
[PrimaryErrorCode] => stdClass Object
(
[Code] => 9590000
[Description] => Paperless Document webservice not available.
)
)
)
)
Errore chiamata webservice UPS
Коды ошибок веб-службы безбумажных документов UPS: https://stackru.com/images/5e7aeb206a18b9502c6d4903f63bae3e60d1bc99.png
какова причина? Надеюсь, кто-нибудь подскажет, спасибо!