PHP SOAP Client throwing error while loading WSDL from paypal
$wsdl = "https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl";
$soap = new SoapClient($wsdl);
thr开发者_开发知识库ows the error:
SOAP-ERROR: Parsing Schema: unexpected in sequence
Tried on PHP versions 5.3.4, 5.3.0
The problem is in https://www.paypalobjects.com/wsdl/eBLBaseComponents.xsd which is a dependency for https://www.paypalobjects.com/wsdl/PayPalSvc.wsdl
To work around this issue, you can download the WSDL and its dependencies and fix eBLBaseComponents.xsd manually (remove the erroneous extra > on the fourth line from the bottom right after ).
1) Download the following 4 files to the same directory
https://www.paypal.com/wsdl/PayPalSvc.wsdl
https://www.paypal.com/wsdl/eBLBaseComponents.xsd
https://www.paypal.com/wsdl/CoreComponentTypes.xsd
https://www.paypal.com/wsdl/EnhancedDataTypes.xsd
2) Remove the erroneous extra ">" on the fourth line from the bottom for eBLBaseComponents.xsd.
3) Upload your changes to your own host, or store them locally depending on your application.
4) In your application, point to the new, fixed WSDL.
It seems Paypal accept only the authorized connect to this SOAP url.
The PayPal SOAP API service is protected to ensure that only authorized PayPal members use it.
You can read about it here.
精彩评论