2016-12-01 58 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也仍然得到同样的问题 –