2

これは私のコードです:

<?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}が25行目のC:\ xampplite \ htdocs \ OOP\newfile.phpにスローされました

意味がありません。リクエストのヘッダーに操作名を設定しました...ここで何が問題なのか誰か知っていますか?

4

3 に答える 3

1

SoapHeader documentationによると、ヘッダー構築呼び出しの最初のパラメーターとして名前空間 (または少なくとも NULL) を渡す必要があります。

于 2010-03-23T10:48:04.930 に答える
0

これは本当に古いことは知っていますが、次のHTTPヘッダーを指定する必要があります(soapヘッダーではありません-違いに注意してください)。

サービスを見つけるために機能する例を次に示します。

CONTENT-TYPE:SOAP12 X-EBAY-SOA-OPERATION-NAME:findItemsByKeywords X-EBAY-SOA-SECURITY-APPNAME:YOUR-ebay-app-id

于 2012-07-17T21:54:26.033 に答える
0

コードを try/catch に配置し、var_dump() を取得している例外に配置します。これにより、問題の詳細がわかるはずです。

于 2010-03-22T22:08:19.113 に答える