SOAP无法连接到主机

时间:2013-03-05 14:10:02

标签: php soap yii

作为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) {
        ...
      }
    }
  }
}

0 个答案:

没有答案