PHPコンソールアプリケーションとして起動すると、SOAPは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) {
...
}
}
}
}