【发布时间】:2023-03-28 12:03:01
【问题描述】:
我想对 eBay api 进行肥皂调用并按关键字查找产品。在eBay documentation和其他在线资源的帮助下,我想出了这段代码:
$client = new \SoapClient('http://developer.ebay.com/webservices/finding/latest/FindingService.wsdl');
$soap_headers = array(
new \SoapHeader('X-EBAY-SOA-OPERATION-NAME', 'findItemsByKeywords'),
new \SoapHeader('X-EBAY-SOA-SERVICE-VERSION', '1.3.0'),
new \SoapHeader('X-EBAY-SOA-REQUEST-DATA-FORMAT', 'XML'),
new \SoapHeader('X-EBAY-SOA-GLOBAL-ID', 'EBAY-US'),
new \SoapHeader('X-EBAY-SOA-SECURITY-APPNAME', '<there would be the key>'),
);
$client->__setSoapHeaders($soap_headers);
// Call wsdl function
$result = $client->__soapCall("findItemsByKeywords", array("keywords" => "Potter"));
但是,此代码会导致错误: "服务操作未知, 500 内部服务器错误 - SoapFault"
我试着把第一行改成这样(不知道为什么会有所不同,但我在某处看到过):
$client = new \SoapClient(NULL, array(
"location" => 'http://svcs.sandbox.ebay.com/services/search/FindingService/v1',
'uri' => 'http://svcs.sandbox.ebay.com/services/search/FindingService/v1')
);
现在这会导致这个错误:缺少 SOA 操作名称标头, 500 内部服务器错误 - SoapFault
有人知道导致这些错误发生的原因以及如何解决这些错误吗?
谢谢你,迈克!
【问题讨论】:
-
@Cray 很抱歉,我拒绝了您的编辑。我以为是审计。我为此道歉。您的编辑根本不是垃圾邮件或破坏行为。以后我会尽量减少对审计的敏感度。