简体   繁体   English

如何使用PHP Soap客户端检查WSDL是否正常工作

[英]How to check wsdl is working or not using php soap client

I am having following api which is based on wsdl 我正在使用基于wsdl的api

http://api.testdomain.com/services/TestService?wsdl http://api.testdomain.com/services/TestService?wsdl

The above API is now working for most of the time so I need to check whether the API is connected whenever I open my website. 上面的API现在大部分时间都在工作,因此我每次打开网站时都需要检查API是否已连接。 I Tried following piece of code 我尝试了以下代码

$client = new SoapClient("api.testdomain.com/services/TestService?wsdl", array('exceptions' => 0));

if (is_soap_fault($client)) {
    trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
} else {
    echo 'con';
}

But always getting error as 但是总是因为

Warning: SoapClient::SoapClient(): I/O warning : failed to load external entity "api.testdomain.com/services/TestService?wsdl " 警告:SoapClient :: SoapClient():I / O警告:无法加载外部实体"api.testdomain.com/services/TestService?wsdl

尝试在SoapClient()中的URL上添加http://前缀。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM