SOAP 在作为 PHP 控制台应用程序启动时无法连接到 https 主机 从浏览器启动时工作正常。但是每次从 CLI 启动时都会抛出 SOAPFault 两者都使用相同的 .ini 文件,并且主机不使用 wsdl。
$uid = '****';
$xml_header = '<?xml version="1.0" encoding="UTF-8"?><parameters>';
$xml_footer = '</parameters>';
$xml_content = '';
$xml = new SimpleXMLElement($xml_header.$xml_content.$xml_footer);
$options = array(
"location" => 'https://***/wsedi/services/EDIServiceSoap',
"uri" => 'https://***/wsedi/services/Send',
"exceptions" => true,
'trace' => true,
);
$data = array(
new SoapParam('***', "Login"),
new SoapParam('***', "Password"),
new SoapParam($uid, "Uid"),
new SoapParam($xml->asXML(), "Params"),
);
$client = new SoapClient(NULL, $options);
try {
$return = $client->__soapCall("ExecSQL", $data);
print_r($return);
} catch (SoapFault $e) {
echo $e->getMessage();
var_dump($e->getTrace());
}
array(2) {
[0] =>
array(4) {
'function' =>
string(11) "__doRequest"
'class' =>
string(10) "SoapClient"
'type' =>
string(2) "->"
'args' =>
array(5) {
[0] =>
string(739) "<?xml version="1.0" encoding="UTF-8"?>\n<SOAP-ENV:Envelope xm
lns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://***/wsedi/services/Send" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml
ns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schema
s.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
/soap/encoding/"><SOAP-ENV:Body><ns1:ExecSQL><Login xsi:type="xsd:string">***</Login><Password xsi:type="xsd:string">***</P"...
[1] =>
string(52) "https://***/wsedi/services/EDIServiceSoap"
[2] =>
string(50) "https://***/wsedi/services/Send#ExecSQL"
[3] =>
int(1)
[4] =>
int(0)
}
}
[1] =>
array(6) {
'file' =>
string(29) "C:\xampp\htdocs\test\test.php"
'line' =>
int(29)
'function' =>
string(10) "__soapCall"
'class' =>
string(10) "SoapClient"
'type' =>
string(2) "->"
'args' =>
array(2) {
[0] =>
string(7) "ExecSQL"
[1] =>
array(4) {
...
}
}
}
}