在尝试解决此问题时遇到重大问题,我很乐意向可以帮助我完成这项工作的人提供 +500 赏金。
基本上,我正在尝试使用 Nusoap 调用此 Web 服务:
https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?op=QueryCustomer
这是我到目前为止所得到的:
class Eway
{
var $username = 'test@eway.com.au';
var $pw = 'test123';
var $customerId = '87654321';
private function setHeaders($client)
{
$headers = <<<EOT
<eWAYHeader xmlns="http://www.eway.com.au/gateway/managedPayment">
<eWAYCustomerID>$this->customerId</eWAYCustomerID>
<Username>$this->username</Username>
<Password>$this->pw</Password>
</eWAYHeader>
EOT;
$client->setHeaders($headers);
return $client;
}
function getCustomer($ewayId = 9876543211000)
{
$url = 'https://www.eway.com.au/gateway/ManagedPaymentService/managedCreditCardPayment.asmx?WSDL';
$client = new Nusoap_client($url, true);
$this->setHeaders($client);
$args['QueryCustomer'] = array('managedCustomerID'=>$ewayId);
$result = $client->call('QueryCustomer', $args);
print_r($result);
}
}
当我运行此代码并$eway->getCustomer()
出现以下错误时:
Array
(
[faultcode] => soap:Client
[faultstring] => eWayCustomerID, Username and Password needs to be specified in the soap header.
)
我究竟做错了什么?
如果您可以修复我的课程并给我能够使用测试客户 ID 执行 QueryCustomer 方法并返回其信息的工作代码,我将很高兴给您 +500 代表和我永远的感激之情。显然,在我开始赏金之前需要 48 小时,但我保证我会做到的。