我正在尝试使用以下 PHP 代码建立 SOAP 连接,但它在 SoapClient 构造点失败:
// Need to declare these settings here because our php.ini has alternate
// settings due to global purposes for other PHP scripts
ini_set("soap.wsdl_cache_enabled", "0");
ini_set("soap.wsdl_cache", "0");
ini_set("display_errors","On");
ini_set("track_errors","On");
// FedEx web services URL, note the HTTPS
$path_to_wsdl = 'https://wsbeta.fedex.com/web-services';
$soap_args = array(
'exceptions'=>true,
'cache_wsdl'=>WSDL_CACHE_NONE,
'trace'=>1)
;
try {
$client = new SoapClient($path_to_wsdl,$soap_args);
} catch (SoapFault $e) {
var_dump(libxml_get_last_error());
echo "<BR><BR>";
var_dump($e);
}
这个输出:
object(LibXMLError)#1 (6) {
["level"]=> int(1)
["code"]=> int(1549)
["column"]=> int(0)
["message"]=> string(71) "failed to load external entity "https://wsbeta.fedex.com/web-services" "
["file"]=> string(0) ""
["line"]=> int(0)
}
object(SoapFault)#2 (9) {
["message":protected]=> string(158) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://wsbeta.fedex.com/web-services' : failed to load external entity "https://wsbeta.fedex.com/web-services" "
["string":"Exception":private]=> string(0) ""
["code":protected]=> int(0)
["file":protected]=> string(53) "/mnt/array/bell-enterprise/bell/fedex_shipservice.php"
["line":protected]=> int(34)
["trace":"Exception":private]=> array(1) {
[0]=> array(6) {
["file"]=> string(53) "/mnt/array/bell-enterprise/bell/fedex_shipservice.php"
["line"]=> int(34)
["function"]=> string(10) "SoapClient"
["class"]=> string(10) "SoapClient"
["type"]=> string(2) "->"
["args"]=> array(2) {
[0]=> string(37) "https://wsbeta.fedex.com/web-services"
[1]=> array(4) {
["exceptions"]=> bool(true)
["soap_version"]=> int(1)
["cache_wsdl"]=> int(0)
["trace"]=> int(1)
}
}
}
}
["previous":"Exception":private]=> NULL
["faultstring"]=> string(158) "SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://wsbeta.fedex.com/web-services' : failed to load external entity "https://wsbeta.fedex.com/web-services" "
["faultcode"]=> string(4) "WSDL"
}
最佳答案
经过 6 小时的头痛之后,唯一的解决方案是下载 WSDL 文件。
https://wsbeta.fedex.com/web-services 和 https://ws.fedex.com/web-services
它总是会抛出错误 500,因为这不是 wsdl。
从 Technical Resources -> FedEx WebServices For Shipping -> GetStarted 下载 wsdls(点击“Rate Services”,然后点击“Download WSDL or XML”),在你的脚本中你需要加载您本地存储的 WSDL,一切都会像魅力一样工作。
$this->_soapClient = new SoapClient("RateService_v13.wsdl", array('exceptions'=>true, 'trace' => true));
玩得开心!
关于php - SoapClient LibXMLError : failed to load external entity, SOAP-ERROR:解析 WSDL:无法加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10318526/
我有一个字符串input="maybe(thisis|thatwas)some((nice|ugly)(day|night)|(strange(weather|time)))"Ruby中解析该字符串的最佳方法是什么?我的意思是脚本应该能够像这样构建句子:maybethisissomeuglynightmaybethatwassomenicenightmaybethiswassomestrangetime等等,你明白了......我应该一个字符一个字符地读取字符串并构建一个带有堆栈的状态机来存储括号值以供以后计算,还是有更好的方法?也许为此目的准备了一个开箱即用的库?
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
我正在使用这个:4.times{|i|assert_not_equal("content#{i+2}".constantize,object.first_content)}我之前声明过局部变量content1content2content3content4content5我得到的错误NameError:wrongconstantnamecontent2这个错误是什么意思?我很确定我想要content2=\ 最佳答案 你必须用一个大字母来调用ruby常量:Content2而不是content2。Aconstantnamestart
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
我正在使用ruby1.9解析以下带有MacRoman字符的csv文件#encoding:ISO-8859-1#csv_parse.csvName,main-dialogue"Marceu","Giveittohimóhe,hiswife."我做了以下解析。require'csv'input_string=File.read("../csv_parse.rb").force_encoding("ISO-8859-1").encode("UTF-8")#=>"Name,main-dialogue\r\n\"Marceu\",\"Giveittohim\x97he,hiswife.\"\
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳