无法使用SoapClient从WSDL获取数据

时间:2012-12-21 16:44:42

标签: php web-services soap wsdl

我正在尝试从GLS的Track and Trace网络服务中获取一些数据。我希望通过参考编号获取特定订单的数据。此示例中的确切顺序号存在,我可以从他们的网站访问它。但我不能使用这个网络服务。

可以在这里访问.wsdl:

  

http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/Tracking/wsdl/Tracking.wsdl

这就是我现在正在做的事情:

$reference = array(
    'Credentials' => array('UserName' => 'hidden', 'Password' => 'secret'),
    'RefValue' => '291054'
);
$client = new SoapClient('http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/Tracking/wsdl/Tracking.wsdl', array('login' => 'hidden', 'password' => 'secret'));
$result = $client->GetTuDetail($reference);

return $result;

我一直在尝试各种方法来获取数据,但请求大约需要50秒,然后返回:

stdClass Object
(
    [ExitCode] => stdClass Object
        (
            [ErrorCode] => 998
            [ErrorDscr] => No data found
        )

    [TuNo] => 
    [NationalRef] => 
    [ConsigneeAddress] => 
    [ShipperAddress] => 
    [RequesterAddress] => 
    [DeliveryDateTime] => 
    [PickupDateTime] => 
    [Product] => 
    [TuWeight] => 0
)

我已经拔掉了头上的每根头发,我在这里缺少什么?提前谢谢,一百万次。

1 个答案:

答案 0 :(得分:2)

$reference = array(
    'Credentials' => array('UserName' => 'hidden', 'Password' => 'secret'),
    'RefValue' => '18235206982'
);
$client = new SoapClient("http://www.gls-group.eu/276-I-PORTAL-WEBSERVICE/services/Tracking/wsdl/Tracking.wsdl");
$result = $client->GetTuDetail($reference);

print_r($result);

“RefValue”是一个有效的地块编号,因此您应该得到正确的回复。