2017-08-11 1488 views
1

我們的要求是通過SOAP1.2發送請求。我在PHP中使用下面的代碼。SOAP錯誤:錯誤代碼:VersionMismatch,錯誤字符串:錯誤版本

$basic_auth = base64_encode(USERNAME.':'.PASSWORD); 
$opts = array(
    'http'=>array(
      'header' => "Authorization: Basic $basic_auth 
         x-ibm-client-id: $client_id 
         x-ibm-client-secret: $client_secret" 
     ) 
    ); 
$context = stream_context_create($opts); 
$soap_client = new SoapClient(WSDL, array("trace"=>1, 
               "local_cert"=>"/var/www/cert.pem", 
               "passphrase"=>"xxxxx", 
               "soap_version"=>SOAP_1_2, 
               "exeptions"=>true, 
               "stream_context"=>$context, 
               "location"=>LOCATION 
              )); 
try{ 
    $params = array(
     'getBalance' => array(
      'version' => 1, 
      'partnerCode'=>PARTNER_CODE 
     )); 
    $post_response = $soap_client->__soapCall('getBalance', $params); 
    return $post_response; 
} 
catch(SoapFault $fault){ 
    highlight_string($soap_client->__getLastRequestHeaders()); 
    highlight_string($soap_client->__getLastRequest()); 
    die("SOAP Fault: fault code: {$fault->faultcode}, fault string: {$fault->faultstring}"); 
} 

錯誤,我得到的是如下:

SOAP錯誤:錯誤代碼:VersionMismatch,錯誤字符串:錯誤的版本

如何檢查它的天氣要求實際使用SOAP12 ?

回答