这是我的代码:
<?php
error_reporting(E_ALL);
//new instance of soapClient pointing to Ebay finding api
$client = new SoapClient("http://developer.ebay.com/webservices/finding/latest/FindingService.wsdl");
//attach required parameters to soap message header
$header_arr = array();
$header_arr[] = new SoapHeader("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP11");
$header_arr[] = new SoapHeader("X-EBAY-SOA-SERVICE-NAME", "FindingService");
$header_arr[] = new SoapHeader("X-EBAY-SOA-OPERATION-NAME", "findItemsByKeywords");
$header_arr[] = new SoapHeader("X-EBAY-SOA-SERVICE-VERSION", "1.0.0");
$header_arr[] = new SoapHeader("X-EBAY-SOA-GLOBAL-ID", "EBAY-GB");
$header_arr[] = new SoapHeader("X-EBAY-SOA-SECURITY-APPNAME", "REMOVED");
$header_arr[] = new SoapHeader("X-EBAY-SOA-REQUEST-DATA-FORMAT", "XML");
$header_arr[] = new SoapHeader("X-EBAY-SOA-MESSAGE-PROTOCOL", "XML");
$test = $client->__setSoapHeaders($header_arr);
$client->__setLocation("http://svcs.ebay.com/services/search/FindingService/v1"); //endpoint
$FindItemsByKeywordsRequest = array(
"keywords" => "potter"
);
$result = $client->__soapCall("findItemsByKeywords", $FindItemsByKeywordsRequest);
//print_r($client->__getFunctions());
//print_r($client->__getTypes());
//print_r($result);
这是我收到的错误:
致命错误:未捕获的 SoapFault 异常:[axis2ns2:Server] C:\xampplite\htdocs\OOP\newfile.php:25 中缺少 SOA 操作名称标头 堆栈跟踪:#0 C:\xampplite\htdocs\OOP\newfile.php( 25): SoapClient->__soapCall('findItemsByKeyw...', Array) #1 {main} 在 C:\xampplite\htdocs\OOP\newfile.php 第 25 行抛出
没有意义,我已经在请求的header中设置了操作名……有谁知道这里有什么问题吗?