2016-12-01 74 views
0

我試圖用soapClient()訪問SOAP API,但是我陷入了下面的錯誤。PHP:SOAP-ERROR:解析WSDL

SoapFault Object 
(
    [message:protected] => SOAP-ERROR: Parsing WSDL: No element with name '10100/Processes/OrderView/OrderView_v1_0?wsdl' 
    [string:Exception:private] => 
    [code:protected] => 0 
    [file:protected] => C:\xampp\htdocs\api\soap\client.php 
    [line:protected] => 37 
    [trace:Exception:private] => Array 
     (
      [0] => Array 
       (
        [file] => C:\xampp\htdocs\api\soap\client.php 
        [line] => 37 
        [function] => SoapClient 
        [class] => SoapClient 
        [type] => -> 
        [args] => Array 
         (
          [0] => https://example.com:443/orders/v1/orderview?wsdl 
          [1] => Array 
           (
            [trace] => 1 
            [stream_context] => Resource id #4 
            [cache_wsdl] => 0 
           ) 

         ) 

       ) 

     ) 

    [previous:Exception:private] => 
    [faultstring] => SOAP-ERROR: Parsing WSDL: No element with name '10100/Processes/OrderView/OrderView_v1_0?wsdl' 
    [faultcode] => WSDL 
) 

下面是我的代碼:

$header = 'Authorization:'.$tokenType.' '.$accessToken; 
$streamContext = array('http' => array("header" => $header , 'user_agent' => 'PHPSoapClient')); 
$streamContext['ssl'] = array(
    "verify_peer" => false, 
    "verify_peer_name" => false, 
    "allow_self_signed" => false 
); 
try{ 
    $client = new SoapClient('https://example.com:443/orders/v1/orderview?wsdl', array(
           "trace" => 1,     
           "stream_context" => stream_context_create($streamContext), 
           'cache_wsdl' => WSDL_CACHE_NONE 
          )); 
    var_dump($client->__getFunctions()); 
    exit; 

隨着php_curl()它的正常工作並得到迴應,但收到錯誤,而試圖與SoapClient的連接。

回答

0

C:\ xampp \ htdocs \ api \ soap \ client.php的第37行是做什麼的?這可能不是問題所在,但它可能有助於理解錯誤消息。

當您從參數數組中移除stream_context參數時它工作嗎?

+0

行#37是soapClient()函數。我們嘗試沒有stream_context也仍然得到同樣的問題 –