我正在尝试生成如下所示的肥皂标头
<SOAP-ENV:Header>
<RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xsi:type="ebl:CustomSecurityHeaderType">
<Credentials xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:UserIdPasswordType">
<Username>api_username</Username>
<Password>api_password</Password>
<Signature>api_signature</Signature>
<Subject>authorizing_account_emailaddress</Subject>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
参考:https://developer.PayPal.com/webapps/developer/docs/classic/api/PayPalSOAPAPIArchitecture/
我正在尝试在下面做一些事情来生成这个结构,
$credentialsHeader = new SoapHeader("urn:ebay:apis:eBLBaseComponents", "Credentials",
array(
"Username : username.user.name",
"Password : password",
"Signature : signature",
"Subject : my_email_id"
));
$requesterCredential = new SoapHeader("urn:ebay:api:PayPalAPI", "RequesterCredentials", $credentialsHeader);
$client->__setSoapHeaders(array($requesterCredential));
但是我收到一个错误:
{main}Authentication failed. API credentials are incorrect.
我假设我在形成标题的方式上做错了什么?对此有一些见解或帮助会很棒。
它应该是这样的:
$credentialsHeader = new SoapHeader("urn:ebay:apis:eBLBaseComponents", "Credentials",
array(
"Username" => "username.user.name",
"Password" => "password",
"Signature" => "signature",
"Subject" => "my_email_id"
));
$requesterCredential = new SoapHeader("urn:ebay:api:PayPalAPI", "RequesterCredentials", $credentialsHeader);
$client->__setSoapHeaders(array($requesterCredential));