Question

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

No correct solution

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top