php 检查肥皂连接是否工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14268494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Check if soap connection working
提问by Tom Burman
Quick one, How would you go about checking if your connection to a soap server is actually connecting?
快速,您将如何检查与soap服务器的连接是否实际连接?
I have this code:
我有这个代码:
$m_wsdl = "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl";
try {
$client = new SoapClient($m_wsdl);
$this->m_messages = $client->peekMessages('','',10,"");
} catch (Exception $e) {
echo "Exception: \n" . $e->getMessage() . "\n";
}
$this->do_parse_xml();
Obviously my username and password are in the peekmessages field where they should be, and they are both correct i am 100%.
显然我的用户名和密码在 peekmessages 字段中,它们应该是,它们都是正确的,我是 100%。
For some reason its not returning any data at all and i dont know how to check to see if the connection is actually working??
出于某种原因,它根本不返回任何数据,我不知道如何检查连接是否实际工作?
Im getting no exceptions being echo'd
我没有任何例外被回声
Thanks for any help
谢谢你的帮助
回答by Owen Johnson
Use isSoapFault()http://php.net/manual/en/function.is-soap-fault.php
使用isSoapFault()http://php.net/manual/en/function.is-soap-fault.php
Also, the peekMessagesmethod would probably return falseor a SoapFault.
此外,该peekMessages方法可能会返回false或 a SoapFault。
You can also set Exceptionsto true on the SoapClient
您也可以Exceptions在SoapClient

