我正在努力使用SOAP Ligth和PHP在請求端和服務器上的PERL服務器上獲得一些SOAP請求, 。我以前從未與SOAP合作過。使用PHP和SOAP Ligth連接到服務器「無法連接到主機」Ligth(PERL)
當打印跟蹤等時,我嘗試連接的URL看起來有點像:「http://»192.168.1.101/otrs/rpc.pl」。我想這可能是問題的一部分(但我知道什麼...)。下面是跟蹤:
Fault message: Could not connect to host
Fault code: 0
array(2) {
[0]=>
array(4) {
["function"]=>
string(11) "__doRequest"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(5) {
[0]=>
string(645) "
userpasswordTicketObjectTicketCreateNumber
"
[1]=>
string(35) "http://192.168.1.101/otrs/rpc.pl"
[2]=>
string(13) "Core#Dispatch"
[3]=>
int(1)
[4]=>
int(0)
}
}
[1]=>
array(6) {
["file"]=>
string(54) "/Library/WebServer/Documents/SMICTestProject/index.php"
["line"]=>
int(37)
["function"]=>
string(10) "__soapCall"
["class"]=>
string(10) "SoapClient"
["type"]=>
string(2) "->"
["args"]=>
array(2) {
[0]=>
string(8) "Dispatch"
[1]=>
array(4) {
[0]=>
string(8) "user"
[1]=>
string(11) "password"
[2]=>
string(12) "TicketObject"
[3]=>
string(18) "TicketCreateNumber"
}
}
}
}
Fault trace: // Of some reason this ends up after the actual trace
Fault line: 37
這裏是產生異常的代碼:
try {
$client = new SoapClient(null, array(
'location' => "http://192.168.1.101/otrs/rpc.pl",
'uri' => "Core",
'trace' => 1,
'login' => "user",
'password' => "password",
'style' => SOAP_RPC,
'use' => SOAP_ENCODED
));
$ticketnumber = $client->__soapCall("Dispatch", array("user", "password", "TicketObject", "TicketCreateNumber"));
//Here happens a lot of things, but since this code is never reached I skip including it.
} catch (SoapFault $fault) {
//trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
echo "Fault message: ".$fault->getMessage()."\n";
echo "Fault code: ".$fault->getCode()."\n";
echo "Fault trace: ".var_dump($fault->getTrace())."\n";
echo "Fault line: ".$fault->getLine()."\n";
echo "Bad SOAP request\n";
echo "REQUEST:\n".$client->__getLastRequest()."\n";
echo "RESPONSE:\n".$client->__getLastResponse()."\n";
echo "</pre>";
exit;
}
有什麼問題,我該如何解決?我應該編碼的URL ...?
我只包括我認爲必要的東西,請讓我知道是否應該添加一些東西。我在這裏可以包含的任何日誌中絕對沒有任何東西,我發現它本身很奇怪。
我在服務器端使用OpenSUSE/Apache,在客戶端使用Mac/Apache/PHP。
預先感謝您!
當您在瀏覽器中打開http://ï¿¿¿192.168.1.101/otrs/rpc.pl'時看到了什麼?爲什麼這個奇怪的角色在這裏? – Zyava
當我在瀏覽器中打開它時,我得到:Firefox找不到服務器xn - 192-0gau00a.168.1.101。我不知道爲什麼這個鏈接看起來像這樣,我沒有做任何事情來添加這些奇怪的字符。 – Nicsoft
這是相同的錯誤(無法連接到主機)。嘗試刪除這個奇怪的字符,然後重試。 – Zyava