Php被政策拒绝。 (来自客户)

时间:2016-06-17 08:45:23

标签: php

我正在使用Soap客户端服务,我遇到一个错误,指出 - 被政策拒绝。 (来自客户)。即使我已正确包含pem文件。在pem文件中,我以下面的格式添加了私钥和认证密钥,这是我认为的完美。

请帮我修复错误 - 政策拒绝。 (来自客户)

-----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY----- show a private key in PEM format.
-----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- show a certificate file in PEM format.

以下是我的代码:

<?php
    $path_to_wsdl = "https://webservicesgatewaytest.sprint.com:444/rtb2/services/wireless/account/ContactPreferenceManagementService/v1?wsdl";
    ini_set("soap.wsdl_cache_enabled", "0");

   $local_cert = "trocglobal-01-pub.pem";

   $client = new SoapClient($path_to_wsdl, array('local_cert'=> $local_cert,'trace' => 1,'encoding' => 'UTF-8')); // Refer to http://us3.php.net/manual/en/ref.soap.php for more information

   $headerBody['trackingMessageHeader'] = array(
    'applicationId'=>'ENGE',
    'applicationUserId' => 'ENGE',
    'consumerId' => 'engage',
    'messageId' => rand(100000,500000),
    'timeToLive' => 600,
    'messageDateTimeStamp' => date("c")
 );

    $request = array(
    'globalPreferenceList' => array(
    'globalPreferenceInfo' => array(
        'contactType'=>'Phone',
        'certifyRuleName' => 'SPRCFT01',
        'contactTypeValueInfo' => array('mdn' => '7600763938'),
        'campaignName' => 'SPRINT'
        )
      )
    );

    try {
        $header = new SoapHeader('http://integration.sprint.com/eai/services/ContactPreferenceManagementService/v1/ContactPreferenceManagementService.wsdl',
        'wsMessageHeader', // header name
        $headerBody);

        $client->__setSoapHeaders($header);

     try {
         //$response = $client->queryContactGlobalPreferences($request);  // Soap web service invocation
         $response = $client->__soapCall('QueryContactGlobalPreferences',array($request));  // Soap web service invocation

         echo "<pre>";print_r($response);exit;

    }
    catch (Exception $e)
    {
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }

if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR'){
    printSuccess($client, $response);

    //fwrite($fp, $response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image); //Create PNG or PDF file
}else{
    printError($client, $response);
}

writeToLog($client);    // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}

?>

1 个答案:

答案 0 :(得分:0)

好像你以错误的方式安装了sprint证书。 下载您的证书并安装它:

在TOOLKIT_HOME内: 一个。在Windows上运行Sprint-CertGen.bat 要么 湾在Unix上运行Sprint-CertGen.sh

同时检查您的防火墙是否不会阻止sprint网址。 出于安全原因,我无法在此处发布网址