dpjj4763 2010-06-23 00:05
浏览 39

paypal SoapClient无法正常工作

I am using PHP's SoapClient class to connect to paypal. I have a number of problems:

  1. The paramaters I pass to the soap call are array('ReturnAllCurrencies'=>0, 'Version'=>'63.0') but as you can see in the request below, 63.0 is put in <param1> whatever that is. I don't even see ReturnAllCurrencies in the request.

In this request I am performing a GetBalance command:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:ebay:api:PayPalAPI" xmlns:ns2="urn:ebay:apis:eBLBaseComponents">
      <SOAP-ENV:Header>
            <ns1:RequesterCredentials>
                  <ns2:Credentials>
                        <ns2:Username>xxxx</ns2:Username>
                        <ns2:Password>xxx</ns2:Password>
                        <ns2:Signature>xxx</ns2:Signature>
                  </ns2:Credentials>
            </ns1:RequesterCredentials>
      </SOAP-ENV:Header>
      <SOAP-ENV:Body>
            <ns1:GetBalanceReq/>
            <param1>63.0</param1>
      </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I found the request above via SoapClient::__getLastRequest(). It doesn't exacly look like the example on the paypal website. What's with the GetBalanceReq tag? Why does it have the *Req suffix?

2.When using the production server and wsdl files, I get a php error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://www.paypal.com/wsdl/PayPalSvc.wsdl&#039; : Start tag expected, '<' not found

Furthermore if I try to visit the production certificate url in FireFox (https://api.paypal.com/2.0/) I get a ssl_error_handshake_failure_alert

Am I supposed to download the wsdl file and point to a local version in the first argument of SoapClient::__construct or am I simple supposed to point to the paypal hosted copy? I originally assumed the latter, but now I'm not sure

  • 写回答

1条回答 默认 最新

  • doulaopu2343 2011-04-11 07:41
    关注

    Firstly, "ReturnAllCurrencies" should be a string, not an integer. Also, you need to wrap the GetBalanceRequestType fields inside a GetBalanceRequest element for it to work. For more info regarding the first part of your question along with a working solution, look here:

    simple php SoapClient example for paypal needed

    The second part of your question sounds like a temporary issue with the Paypal infrastructure. Best practice is to NOT use a local copy of the WSDL but to turn WSDL caching on and let PHP decide when to refresh it.

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)