2016-03-17 73 views
1

我正试图整合fedex API并获取此错误。无法加载外部实体

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "../wsdl/RateService_v13.wsdl" in test.php on line 12

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '../wsdl/RateService_v13.wsdl' in D:\wamp\www\fedexapi\AddressValidationService_v4_php\php\AddressValidationWebServiceClient\rate_test.php:12 Stack trace: #0 D:\wamp\www\fedexapi\AddressValidationService_v4_php\php\AddressValidationWebServiceClient\rate_test.php(12): SoapClient->SoapClient('../wsdl/RateSer...', Array) #1 {main} thrown in test.php on line 12

<?php 
// Copyright 2009, FedEx Corporation. All rights reserved. 
// Version 2.0.0 

require_once('../library/fedex-common.php5'); 

//The WSDL is not included with the sample code. 
//Please include and reference in $path_to_wsdl variable. 
$path_to_wsdl = "../wsdl/LocationsService_v3.wsdl"; 

ini_set("soap.wsdl_cache_enabled", "0"); 

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

$request['WebAuthenticationDetail'] = array(
     'ParentCredential' => array(
      'Key' => getProperty('parentkey'), 
      'Password' => getProperty('parentpassword') 
     ), 
     'UserCredential' => array(
      'Key' => getProperty('key'), 
      'Password' => getProperty('password') 
    ) 
); 

?> 

如何解决这个问题?

回答

1

Afaik SoapClient的第一个参数需要是一个URI,而不是磁盘上的本地文件名。

该错误表示无法加载wsdl。 看看specsthis expample应该说清楚。

0

相对路径也适用。

在我的情况下,我不得不修复wsdl文件的相对路径。

相关问题