我调用了一个 Web 服务,它成功连接并返回了它的方法,但是当我调用这个函数之一时,它得到了未经授权的错误..
我的代码在这里
try {
$service = new SoapClient("http://www.go-to-orbit.com/oos/solo/soapServer.php?wsdl");
$header = new SoapHeader('http://oncore.qubitwebtechnologies.com/', 'AuthorisationHeader', array('login' => "ONCORE",'password' => "ONCORE"), false);
$service->__setSoapHeaders(array($header));
var_dump($service->__getFunctions());
$response = $service->__soapCall("getAllOnHand", array() );
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
print_r($response);
结果是
array(2) { [0]=> string(18) "Map getAllOnHand()" [1]=> string(33) "int getOnHand(string $partNumber)" } Caught exception: Unauthorized
我尝试了 2 天,但没有运气,谁能救救我
错误信息
Exception object(SoapFault)#4 (9) { ["message":protected]=> string(12) "Unauthorized" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(47) "/home/qubitweb/public_html/oncore/jumi/soap.php" ["line":protected]=> int(87) ["trace":"Exception":private]=> array(1) { [0]=> array(6) { ["file"]=> string(47) "/home/qubitweb/public_html/oncore/jumi/soap.php" ["line"]=> int(87) ["function"]=> string(10) "__soapCall" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(12) "getAllOnHand" [1]=> array(0) { } } } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(12) "Unauthorized" ["faultcode"]=> string(6) "Sender" }