简体   繁体   中英

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://…' in Google App Engine PHP App

I am trying to connect to Amazon Web Services from my GAE account using a simple PHP script. However, the very first line is throwing an error:

$wsdlURI = ' http://www.webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl '; $soapClient = new SoapClient($wsdlURI);

I get this error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://.....'failed to load external entity

When I do a simple file_get_contents on the above URL, it works just fine. Only the SoapClient is not able to get the handle on the wsdl file....and ONLY GAE seems to have this problem. I tried the same code on another server and everything works fine.

Is there any setting in GAE that I am missing??

This is also related to the disabling of loading of loading of external entities by default, you will need to enable this to get this to work.

First, you must create a php.ini file containing this line:

google_app_engine.enable_functions = "libxml_disable_entity_loader"

Then you add the following before your call.

libxml_disable_entity_loader(false);

For SoapClient to work using sockets application also needs to have billing enabled.

This issue is likely related: https://code.google.com/p/googleappengine/issues/detail?id=9858 . Looks like SOAP needs sockets support, which is not yet part of the PHP runtime.

检查您是否激活了以下扩展:php open ssl和php soap client。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM