-1
有這樣的代碼:SOAP和PHP不工作|未捕獲的SOAPFault例外:[HTTP]錯誤獲取HTTP頭
set_time_limit(100);
ini_set('user_agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1');
ini_set('default_socket_timeout', 100);
ini_set('soap.wsdl_cache_enabled', 0);
echo '<plaintext style="font-size:20px;">';
$client = new SoapClient('http://www.test/?wsdl', array(
'soap_version' => SOAP_1_2,
'cache_wsdl' => WSDL_CACHE_NONE,
'use' => SOAP_LITERAL,
'style' => SOAP_DOCUMENT,
'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.1',
'connection_timeout' => 120
));
// $result = $client->ValidaRut(array(
$result = $client->__call('ValidaRut', array(
'rut' => 11111111,
'dv' => '1',
'cup' => '1',
'ipserver' => gethostbyname($_SERVER['SERVER_NAME']) ,
'ipcliente' => $_SERVER['REMOTE_ADDR']
));
但不工作,PHP說: 致命錯誤:未捕獲的SOAPFault異常:[HTTP]錯誤獲取HTTP標頭在/ home/.../test.php:1
會發生什麼情況?對不起我的英語。 數據轉儲:
print_r($client->__getFunctions());
Array
(
[0] => ValidaRutResponse ValidaRut(ValidaRut $parameters)
)
print_r($client->__getTypes());
Array
(
[0] => struct ValidaRut {
double rut;
string dv;
string cup;
string ipserver;
string ipcliente;
}
[1] => struct ValidaRutResponse {
boolean ValidaRutResult;
}
[2] => int char
[3] => duration duration
[4] => string guid
)
安全模式關閉。我使用WHM/cPanel,安裝庫。謝謝。
您的錯誤消息表明您的肥皂呼叫在第1行..但您的示例代碼表明否則。此外,你得到一個SoapException,但你沒有在你的soap客戶端構造函數中啓用它們。你是否顯示正確的代碼? – 2012-07-18 13:44:38
行錯誤是「$ result = $ client - > __ call('ValidaRut',array(...」是最後一行,錯誤不在連接中,當調用函數時 – 2012-07-18 13:53:07
PHP本地SOAP擴展是所有邪惡的根源和我早期禿頂的原因,我強烈推薦使用[NuSOAP](http://sourceforge.net/projects/nusoap/)代替 – DaveRandom 2012-07-18 14:00:07