2012-01-13 71 views
1

这是当前的SOAP消息发送到SOAP贝宝API:PHP SoapClient的贝宝SetExpressCheckout验证失败

<?xml version="1.0" encoding="UTF-8"?> 

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns1="urn:ebay:apis:eBLBaseComponents" 
xmlns:ns2="ebl:SetExpressCheckoutRequestDetails" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns3="urn:ebay:api:PayPalAPI" 
xmlns:ns4="ebl:UserIdPasswordType"> 

<SOAP-ENV:Header> 
<ns3:RequesterCredentials xsi:type="ns4:UserIdPasswordType"> 
     <Username>xxxxx</Username> 
     <Password>xxxxx</Password> 
     <Signature>xxxxx</Signature> 
    </ns3:RequesterCredentials> 
</SOAP-ENV:Header> 

<SOAP-ENV:Body> 
<ns3:SetExpressCheckoutReq> 
    <ns3:SetExpressCheckoutRequest> 

     <ns1:Version>84.0</ns1:Version> 

       <ns1:SetExpressCheckoutRequestDetails 
       xsi:type="ns2:SetExpressCheckoutRequestDetailsType"> 

       <ReturnUrl>url_to_/success.paypal.php</ReturnUrl> 
       <CancelUrl>url_to_/cancel.paypal.php</CancelUrl> 
       <LocaleCode>US</LocaleCode> 

       </ns1:SetExpressCheckoutRequestDetails> 

    </ns3:SetExpressCheckoutRequest> 
    </ns3:SetExpressCheckoutReq> 
</SOAP-ENV:Body> 

</SOAP-ENV:Envelope> 

我实例化这个PHP5 SoapClient的:

//Endpoint 
$location = 'https://api-3t.sandbox.paypal.com/2.0/'; 
$uri = 'urn:ebay:api:PayPalAPI'; 

//SoapClient options 
$options = array('trace' => 1, 'exceptions' => 1, 'location'=>$location, 'uri'=>$uri); 

//My Soap Client 
$client =new SoapClient('https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl',$options); 

但是,当我打电话SetExpressCheckout贝宝SOAP服务,我收到以下肥皂信息:

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:cc="urn:ebay:apis:CoreComponentTypes" 
xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" 
xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" 
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" 
xmlns:ed="urn:ebay:apis:EnhancedDataTypes" 
xmlns:ebl="urn:ebay:apis:eBLBaseComponents" 
xmlns:ns="urn:ebay:api:PayPalAPI"> 

<SOAP-ENV:Header> 
    <Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext" 
         xsi:type="wsse:SecurityType"></Security> 

    <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" 
            xsi:type="ebl:CustomSecurityHeaderType"> 

     <Credentials xmlns="urn:ebay:apis:eBLBaseComponents" 
           xsi:type="ebl:UserIdPasswordType"> 
        </Credentials> 
    </RequesterCredentials> 

</SOAP-ENV:Header> 

<SOAP-ENV:Body id="_0"> 

    <SetExpressCheckoutResponse xmlns="urn:ebay:api:PayPalAPI"> 

     <Timestamp xmlns="urn:ebay:apis:eBLBaseComponents"> 
       2012-01-13T12:09:01Z 
      </Timestamp> 

    <Ack xmlns="urn:ebay:apis:eBLBaseComponents">Failure</Ack> 
    <CorrelationID xmlns="urn:ebay:apis:eBLBaseComponents"> 
       c8d551f118a1 
      </CorrelationID> 

    <Errors xmlns="urn:ebay:apis:eBLBaseComponents" xsi:type="ebl:ErrorType"> 

      <ShortMessage xsi:type="xs:string"> 
          Authentication/Authorization Failed 
        </ShortMessage> 

      <LongMessage xsi:type="xs:string"> 
         You do not have permissions to make this API call 
        </LongMessage> 

      <ErrorCode xsi:type="xs:token">10002</ErrorCode> 
      <SeverityCode xmlns="urn:ebay:apis:eBLBaseComponents"> 
          Error 
         </SeverityCode> 
     </Errors> 

     <Version xmlns="urn:ebay:apis:eBLBaseComponents">84.0</Version> 
     <Build xmlns="urn:ebay:apis:eBLBaseComponents">2271164</Build> 

    </SetExpressCheckoutResponse> 
</SOAP-ENV:Body> 

</SOAP-ENV:Envelope> 

Ne尽管如此,我用我的企业帐户测试的API凭证... 我不明白为什么我的代码不起作用。

错误是:'您无权进行此API调用',但它有可能如何?因为我使用正确的端点服务(沙箱)?

有人可以帮助我吗?

回答

-1

如果要连接到Sandbox API端点,则必须使用沙盒测试帐户的API凭据。
您可以通过https://developer.paypal.com/>测试帐户>预先配置来创建测试帐户。

+0

这就是我已经做了,但它不工作... – 2012-01-16 08:26:57