Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php soapclient wsdl SOAP-ERROR:解析wsdl:canned';t从_Php_Web Services_Soap_Wsdl - Fatal编程技术网

php soapclient wsdl SOAP-ERROR:解析wsdl:canned';t从

php soapclient wsdl SOAP-ERROR:解析wsdl:canned';t从,php,web-services,soap,wsdl,Php,Web Services,Soap,Wsdl,我在stackoverflow上搜索过这里,但我还没有找到解决我具体问题的方法。我一直在犯错误 SOAP-ERROR: Parsing WSDL: Couldnt load from "https://sampleurl.com/MerchantQueryService.asmx?WSDL" : failed to load external entity "https://sampleurl.com/MerchantQueryService.asmx?WSDL" 我正在尝试使用一个带有UR

我在stackoverflow上搜索过这里,但我还没有找到解决我具体问题的方法。我一直在犯错误

 SOAP-ERROR: Parsing WSDL: Couldnt load from "https://sampleurl.com/MerchantQueryService.asmx?WSDL" : failed to load external entity "https://sampleurl.com/MerchantQueryService.asmx?WSDL"
我正在尝试使用一个带有URL的SOAP API,如

https://sampleurl.com/MerchantQueryService.asmx?WSDL 
我正在本地主机上运行MAMP并使用godaddy共享主机,我已经尝试了这两种方式,wsdl文件可以在这里找到

http://clemdemo.com/test.wsdl
在PHP中,我使用下面的代码

error_reporting(-1);
ini_set('display_errors', 'On');
ini_set('soap.wsdl_cache_enabled', 0);

echo "<pre>";

try {

$url     = "https://sampleurl.com/MerchantQueryService.asmx?WSDL ";
$headers = [
    'Host: sampleurl.com',
    'Connection: Keep-Alive',
    'User-Agent: PHP-SOAP/5.3.29',
    'Content-Type: text/xml; charset=utf-8',
    'SOAPAction: "RequestTransaction"',
    'Content-Length: 409'];

$rq = [
"userName" => "username_here",
"passWord" => "password_here",
"referenceId" => "3455566694",
"msisdn" => "346774313"];


try {

$cient = new SoapClient($url,
    [
    'soap_version' => SOAP_1_2,
    'exceptions' => 1,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'trace' => 1,
    'stream_context' => stream_context_create(array('http' => array('header' => $headers)))
]);

print_r($cient);
} catch (SoapFault $e) {
    echo "\nFault Code: ".$e->faultcode;
    echo "\nFault String: ".$e->faultstring;
}
错误报告(-1);
ini_设置(“显示错误”、“打开”);
ini_集('soap.wsdl_缓存已启用',0);
回声“;
试一试{
$url=”https://sampleurl.com/MerchantQueryService.asmx?WSDL ";
$headers=[
'主机:sampleurl.com',
“连接:保持活动状态”,
'用户代理:PHP-SOAP/5.3.29',
'内容类型:text/xml;字符集=utf-8',
'SOAPAction:'RequestTransaction',
'内容长度:409'];
$rq=[
“用户名”=>“此处用户名”,
“密码”=>“此处密码”,
“referenceId”=>“3455566694”,
“msisdn”=>“346774313”];
试一试{
$cient=新的SoapClient($url,
[
“soap_版本”=>soap_1_2,
“例外情况”=>1,
'cache\u wsdl'=>wsdl\u cache\u NONE,
“跟踪”=>1,
'stream\u context'=>stream\u context\u create(数组('http'=>array('header'=>$headers)))
]);
印刷(cient);
}捕获(SoapFault$e){
echo“\n故障代码:”.$e->故障代码;
回显“\n故障字符串:”..e->faultstring;
}
在我的MAMP本地主机上,我有SOAP、openssl和curl


此外,我还尝试将(发送请求)与在线WSDL一起使用到API,但在使用PHP的代码中失败了。提供商往往会忽略其SSL证书,因此站点和服务最终会拥有无效的证书。我怀疑这里就是这种情况

如前所述禁用证书验证,或者最好让提供商修复其证书

您的代码可以/应该是:

DEFAULT@SECLEVEL=1

错误消息显示您的应用程序无法读取我们的WSDL。请尝试从运行应用程序的同一台计算机上打开浏览器,查看您是否可以访问位于的WSDL地址

如果没有-您有网络/防火墙/防病毒问题。(在这种情况下)

如果您可以通过浏览器访问此地址-您的应用程序是否仍存在此问题?然后检查可能妨碍防火墙的任何应用程序。(防病毒是最可能的原因)

  • 可以通过以下方法执行更好的诊断:libxml_get_last_error()
  • 可能缓存了错误响应,请在初始化对象时设置“cache\u wsdl”=>wsdl\u cache\u NONE
  • 如果跳过缓存,并在libxml错误中获取:

    LibXMLError对象 ( [级别]=>1 [代码]=>1549 [列]=>0 [消息]=>加载外部实体“URL”失败 [文件]=> [行]=>0 )


在Ubuntu上没有任何描述,那么它就没有拉文件期。你刚刚被Ubuntu更新击中。向他们挥舞布朗克斯礼炮并重新启动。

如果你使用docker,你有可能会因为OpenSSL默认安全级别而出错。即使你禁用了verify并允许自签名SoapClient选项。

尝试在
/etc/ssl/openssl.cnf
中降低seclevelDEFAULT@SECLEVEL=2

RUN sed -i "s|DEFAULT@SECLEVEL=2|DEFAULT@SECLEVEL=1|g" /etc/ssl/openssl.cnf
或者直接添加到Dockerfile中

作者:


您可以通过在容器上运行来验证它

curl-A'curl用户代理'-4https://ewus.nfz.gov.pl/ws-broker-server-ewus/services/Auth?wsdl
RUN sed -i "s|DEFAULT@SECLEVEL=2|DEFAULT@SECLEVEL=1|g" /etc/ssl/openssl.cnf